@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Space+Grotesk:wght@500;700&display=swap');

:root {
    --ui-bg: #07111b;
    --ui-bg-deep: #020816;
    --ui-surface: rgba(8, 18, 32, 0.82);
    --ui-surface-soft: rgba(255, 255, 255, 0.04);
    --ui-surface-strong: rgba(255, 255, 255, 0.08);
    --ui-line: rgba(255, 255, 255, 0.1);
    --ui-line-strong: rgba(255, 255, 255, 0.18);
    --ui-text: #f7fbff;
    --ui-muted: rgba(223, 232, 246, 0.7);
    --ui-muted-soft: rgba(223, 232, 246, 0.5);
    --ui-accent: #38bdf8;
    --ui-accent-deep: #2563eb;
    --ui-success: #34d399;
    --ui-danger: #fb7185;
    --ui-warning: #fbbf24;
    --ui-shadow: 0 28px 90px rgba(1, 7, 18, 0.58);
    --ui-shadow-accent: 0 14px 40px rgba(37, 99, 235, 0.24);
    --ui-radius-xl: 24px;
    --ui-radius-lg: 18px;
    --ui-radius-md: 14px;
    --ui-font-body: "Noto Sans SC", "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
    --ui-font-display: "Plus Jakarta Sans", "Noto Sans SC", "Microsoft YaHei", sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ui-text);
    font-family: var(--ui-font-body);
    background:
        radial-gradient(800px 480px at 12% 10%, rgba(56, 189, 248, 0.2), transparent 60%),
        radial-gradient(760px 460px at 88% 18%, rgba(37, 99, 235, 0.16), transparent 58%),
        radial-gradient(720px 420px at 50% 100%, rgba(14, 165, 233, 0.14), transparent 60%),
        linear-gradient(180deg, #05101a 0%, #07111b 40%, #030813 100%);
    background-attachment: fixed;
    overflow-x: hidden;
}

body::before,
body::after {
    content: "";
    position: fixed;
    width: 420px;
    height: 420px;
    border-radius: 999px;
    filter: blur(90px);
    opacity: 0.22;
    pointer-events: none;
    z-index: 0;
}

body::before {
    left: -120px;
    top: 8vh;
    background: #0ea5e9;
}

body::after {
    right: -120px;
    bottom: 0;
    background: #2563eb;
}

a,
button,
input,
select,
textarea {
    font: inherit;
}

button {
    border: 0;
    cursor: pointer;
}

a,
button {
    touch-action: manipulation;
}

.center-wrap,
.shell,
.download-shell,
.handoff-overlay {
    position: relative;
    z-index: 1;
}

.center-wrap {
    min-height: 100dvh;
    padding: clamp(16px, 3vw, 28px);
    display: flex;
    justify-content: center;
    align-items: center;
}

.auth-card,
.card,
.handoff-card {
    position: relative;
    overflow: hidden;
    border-radius: var(--ui-radius-xl);
    border: 1px solid var(--ui-line);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03)),
        var(--ui-surface);
    backdrop-filter: blur(18px) saturate(140%);
    box-shadow: var(--ui-shadow);
}

.auth-card::before,
.card::before,
.handoff-card::before {
    content: "";
    position: absolute;
    inset: -1px;
    background:
        radial-gradient(520px 180px at 18% 0%, rgba(56, 189, 248, 0.18), transparent 62%),
        radial-gradient(460px 180px at 84% 0%, rgba(37, 99, 235, 0.16), transparent 62%);
    pointer-events: none;
}

.auth-card > *,
.card > *,
.handoff-card > * {
    position: relative;
    z-index: 1;
}

.auth-card {
    width: min(720px, 100%);
    min-width: 0;
    padding: clamp(20px, 2.5vw, 26px);
}

.brand {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.title {
    margin: 0;
    font-family: var(--ui-font-display);
    font-size: clamp(1.35rem, 1.8vw, 1.8rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--ui-text);
    word-break: break-word;
}

.tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    padding: 6px;
    margin-bottom: 14px;
    border-radius: 16px;
    border: 1px solid var(--ui-line);
    background: rgba(255, 255, 255, 0.04);
}

.tab-btn {
    min-height: 42px;
    border-radius: 12px;
    color: var(--ui-muted);
    font-weight: 700;
    font-size: 0.94rem;
    letter-spacing: 0.01em;
    background: transparent;
    transition: transform 180ms ease, color 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.tab-btn:hover {
    transform: translateY(-1px);
    color: var(--ui-text);
}

.tab-btn.active {
    color: #fff;
    border: 1px solid rgba(125, 211, 252, 0.18);
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.26), rgba(37, 99, 235, 0.3));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 10px 24px rgba(37, 99, 235, 0.18);
}

.input {
    width: 100%;
    min-height: 48px;
    padding: 0 14px;
    border-radius: 14px;
    border: 1px solid var(--ui-line);
    background: rgba(2, 10, 22, 0.54);
    color: var(--ui-text);
    outline: none;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease, transform 180ms ease;
}

.input::placeholder {
    color: var(--ui-muted-soft);
}

.input:focus {
    border-color: rgba(125, 211, 252, 0.5);
    background: rgba(2, 10, 22, 0.74);
    box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

select.input {
    appearance: none;
    padding-right: 42px;
    background-image:
        linear-gradient(45deg, transparent 50%, rgba(247, 251, 255, 0.7) 50%),
        linear-gradient(135deg, rgba(247, 251, 255, 0.7) 50%, transparent 50%);
    background-position: calc(100% - 19px) 55%, calc(100% - 13px) 55%;
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
}

.btn-primary,
.btn-secondary,
.btn-reset,
.btn-danger,
.btn-download,
.corner-btn {
    min-height: 46px;
    padding: 0 16px;
    border-radius: 14px;
    font-weight: 800;
    font-size: 0.98rem;
    letter-spacing: 0.01em;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    white-space: nowrap;
    transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease, border-color 180ms ease, background 180ms ease, color 180ms ease;
}

.btn-primary {
    width: 100%;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: linear-gradient(135deg, #0ea5e9, #2563eb 54%, #1e40af);
    box-shadow: var(--ui-shadow-accent);
}

.btn-primary:hover,
.btn-reset:hover,
.btn-danger:hover,
.btn-download:hover,
.corner-btn:hover,
.btn-secondary:hover {
    transform: translateY(-1px);
    filter: brightness(1.04);
}

.btn-primary:hover {
    box-shadow: 0 18px 46px rgba(37, 99, 235, 0.3);
}

.btn-primary:active,
.btn-reset:active,
.btn-danger:active,
.btn-download:active {
    transform: translateY(1px) scale(0.995);
}

.btn-secondary,
.corner-btn {
    color: rgba(247, 251, 255, 0.92);
    border: 1px solid var(--ui-line);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.btn-reset {
    color: #04120c;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: linear-gradient(135deg, #6ee7b7, #34d399 55%, #10b981);
    box-shadow: 0 14px 36px rgba(16, 185, 129, 0.26);
}

.btn-danger {
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: linear-gradient(135deg, #fb7185, #ef4444 50%, #be123c);
    box-shadow: 0 14px 36px rgba(244, 63, 94, 0.24);
}

.btn-download {
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: linear-gradient(135deg, #38bdf8, #2563eb 50%, #1d4ed8);
    box-shadow: 0 14px 36px rgba(37, 99, 235, 0.22);
}

.btn-full {
    width: 100%;
}

.corner-actions {
    position: absolute;
    top: 18px;
    right: 18px;
    display: flex;
    gap: 10px;
    z-index: 3;
}

.corner-btn {
    min-height: 36px;
    padding: 0 12px;
    border-radius: 12px;
    font-size: 0.88rem;
}

.lang-switch,
.lang-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.lang-switch {
    margin-top: 14px;
}

.lang-switch a,
.lang-btn,
.lang-active {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid var(--ui-line);
    background: rgba(255, 255, 255, 0.05);
    color: var(--ui-muted);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 180ms ease, color 180ms ease, background 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.lang-switch a:hover,
.lang-btn:hover,
.lang-active:hover {
    transform: translateY(-1px);
    color: #fff;
}

.lang-active {
    color: #fff;
    border-color: rgba(56, 189, 248, 0.4);
    background: rgba(37, 99, 235, 0.18);
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.18);
}

.hint {
    margin-top: 10px;
    color: var(--ui-muted-soft);
    font-size: 0.78rem;
    line-height: 1.5;
}

.shell {
    width: min(1160px, 100%);
    margin: 0 auto;
    padding: clamp(16px, 2vw, 24px) 12px 24px;
}

.dashboard-shell {
    display: grid;
    gap: 18px;
}

.dashboard-masthead {
    padding: 24px 26px;
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: flex-start;
}

.dashboard-copy {
    display: grid;
    gap: 8px;
}

.dashboard-kicker {
    color: var(--ui-accent);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.dashboard-title {
    margin: 0;
    font-family: var(--ui-font-display);
    font-size: clamp(2rem, 3vw, 2.8rem);
    line-height: 1;
    letter-spacing: -0.05em;
}

.dashboard-subtitle {
    margin: 0;
    color: var(--ui-muted);
    font-size: 0.98rem;
}

.dashboard-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
}

.dashboard-actions form {
    margin: 0;
}

.card {
    padding: 18px;
}

.section {
    padding: 16px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.035);
}

.section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
}

.section-title {
    margin: 0;
    font-size: 1.08rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    color: #fff;
}

.label {
    display: block;
    color: var(--ui-muted-soft);
    font-size: 0.76rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.value {
    font-weight: 700;
    color: #eef6ff;
    font-variant-numeric: tabular-nums;
}

.info-grid,
.meta-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.info-card {
    min-height: 102px;
    padding: 16px 18px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(5, 12, 24, 0.42);
    display: grid;
    gap: 10px;
    align-content: space-between;
}

.info-card.span-2 {
    grid-column: 1 / -1;
}

.value-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.value-main {
    min-width: 0;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.value-main .value {
    overflow-wrap: anywhere;
}

.copy-btn {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border-radius: 12px;
    border: 1px solid var(--ui-line);
    background: rgba(255, 255, 255, 0.05);
    color: var(--ui-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 180ms ease, color 180ms ease, background 180ms ease, border-color 180ms ease;
}

.copy-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--ui-line-strong);
    transform: translateY(-1px);
}

.sub-groups {
    display: grid;
    gap: 10px;
}

.sub-group,
.sub-flat-row {
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.045);
}

.sub-group {
    padding: 14px 16px;
}

.sub-flat-row {
    padding: 14px 16px;
}

.sub-group-head,
.sub-row,
.sub-flat-row {
    display: flex;
    justify-content: space-between;
    gap: 14px;
}

.sub-group-head {
    align-items: flex-start;
    margin-bottom: 12px;
}

.sub-row {
    align-items: flex-start;
    padding-top: 12px;
}

.sub-row + .sub-row {
    margin-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sub-group-title,
.sub-name {
    font-weight: 700;
}

.sub-group-title {
    font-family: var(--ui-font-display);
    font-size: 1rem;
}

.sub-name {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.sub-expiry {
    color: var(--ui-muted);
    white-space: normal;
    text-align: right;
    font-size: 0.88rem;
    font-variant-numeric: tabular-nums;
}

.sub-badge,
.sub-tag-v5 {
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
    font-size: 0.75rem;
    line-height: 1;
}

.sub-tag-v5 {
    color: #bfdbfe;
    border-color: rgba(96, 165, 250, 0.22);
    background: rgba(37, 99, 235, 0.16);
}

.sub-ok {
    color: #93c5fd;
}

.sub-warn {
    color: #fcd34d;
}

.sub-danger {
    color: #fda4af;
}

.sub-expired {
    color: rgba(255, 255, 255, 0.42);
}

.download-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-start;
    padding-top: 4px;
}

.download-shell {
    min-height: 100dvh;
}

.download-frame {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100dvh;
    border: 0;
    opacity: 0;
}

.handoff-overlay {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 24px;
    transition: opacity 220ms ease, transform 220ms ease;
}

.handoff-card {
    width: min(520px, 100%);
    padding: 22px;
    text-align: center;
}

.loader-ring {
    width: 56px;
    height: 56px;
    margin: 0 auto 18px;
    border-radius: 999px;
    border: 3px solid rgba(255, 255, 255, 0.12);
    border-top-color: var(--ui-accent);
    animation: ui-spin 0.9s linear infinite;
}

.handoff-title {
    margin: 0 0 10px;
    font-family: var(--ui-font-display);
    font-size: 1.35rem;
    letter-spacing: -0.04em;
}

.handoff-text {
    margin: 0;
    color: var(--ui-muted);
    line-height: 1.7;
}

body.download-ready .handoff-overlay {
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
}

body.download-ready .download-frame {
    opacity: 1;
}

#case-toast {
    position: fixed;
    right: 22px;
    top: 50%;
    transform: translateY(-50%);
    min-width: 78px;
    padding: 12px 18px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(5, 11, 22, 0.82);
    box-shadow: 0 16px 44px rgba(37, 99, 235, 0.2);
    backdrop-filter: blur(12px);
    font-family: var(--ui-font-display);
    font-size: 1.4rem;
    font-weight: 700;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 220ms ease;
    z-index: 10;
}

@keyframes ui-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 900px) {
    .dashboard-masthead {
        flex-direction: column;
        align-items: stretch;
    }

    .dashboard-actions {
        justify-content: space-between;
    }

    .info-grid,
    .meta-grid {
        grid-template-columns: 1fr;
    }

    .info-card.span-2 {
        grid-column: auto;
    }
}

@media (max-width: 720px) {
    .auth-card,
    .card,
    .handoff-card {
        border-radius: 18px;
    }

    .auth-card {
        padding: 58px 16px 18px;
    }

    .corner-actions {
        top: 12px;
        left: 12px;
        right: 12px;
        justify-content: flex-start;
    }

    .tabs {
        grid-template-columns: 1fr;
    }

    .download-actions,
    .dashboard-actions {
        justify-content: stretch;
    }

    .btn-danger,
    .btn-reset,
    .btn-download {
        width: 100%;
    }

    .sub-group-head,
    .sub-row,
    .sub-flat-row,
    .value-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .sub-expiry {
        white-space: normal;
        text-align: left;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }
}
