:root {
    --bg-color: #030712;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-color: #fbbf24;
    --glass-bg: rgba(15, 23, 42, 0.65);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    --transition-base: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.noise-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    opacity: 0.04; pointer-events: none; z-index: 9999;
    filter: contrast(120%) brightness(120%);
}

.cursor-glow {
    position: fixed; 
    width: 600px; 
    height: 600px;
    background: radial-gradient(circle, rgba(251, 191, 36, 0.08) 0%, transparent 70%);
    pointer-events: none;
    border-radius: 50%;
    z-index: 1;
    transform: translate(-50%, -50%);
    mix-blend-mode: plus-lighter;
    opacity: 0;
    transition: opacity 1s ease;
}
body:hover .cursor-glow { opacity: 1; }

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

[hidden] {
    display: none !important;
}

/* Hard Reset for Native Elements */
button, input, select, textarea {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    outline: none;
    font-family: inherit;
    color: inherit;
    box-shadow: none;
    -webkit-appearance: none;
    appearance: none;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100vh;
    height: 100svh;
    color: var(--text-primary);
    font-family: "Outfit", "Noto Sans SC", sans-serif;
    overflow: hidden !important; 
    -webkit-font-smoothing: antialiased;
    background: transparent;
}

/* Visual Canvas Elements */
.visual-canvas {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
    background-color: var(--bg-color);
    background-image: 
        linear-gradient(to right, rgba(3, 7, 18, 0.8), rgba(3, 7, 18, 0.2), rgba(3, 7, 18, 0.8)),
        url("portal-bg.png");
    background-size: cover;
    background-position: center;
}

.ambient-glow {
    position: absolute;
    width: 60vw;
    height: 60vw;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.2;
}

.g-1 { top: -15%; left: -15%; background: radial-gradient(circle, #3b82f6, transparent 70%); animation: glow-float 25s infinite alternate ease-in-out; }
.g-2 { bottom: -15%; right: -10%; background: radial-gradient(circle, #8b5cf6, transparent 70%); animation: glow-float 20s infinite alternate-reverse ease-in-out; }

/* Floating Symbols Engine */
.symbol {
    position: absolute;
    color: rgba(255, 255, 255, 0.4);
    font-size: clamp(1.5rem, 4vw, 3rem);
    font-weight: 300;
    opacity: 0.04; /* Deep hidden state for 'Pick Light' interaction */
    user-select: none;
    pointer-events: none;
    transition: opacity 0.8s ease;
}

.p-1 { top: 15%; left: 8%; animation: float-diag 18s infinite alternate; }
.p-2 { top: 75%; left: 12%; animation: float-sway 22s infinite alternate; }
.p-3 { top: 45%; left: 25%; animation: float-diag 28s infinite alternate-reverse; }
.p-4 { top: 10%; left: 45%; animation: float-sway 25s infinite; }
.p-5 { top: 85%; left: 35%; animation: float-diag 30s infinite; }
.p-6 { top: 25%; left: 85%; animation: float-sway 19s infinite; }
.p-7 { top: 65%; left: 92%; animation: float-diag 26s infinite alternate; }
.p-8 { top: 40%; left: 78%; animation: float-sway 23s infinite reverse; }
.p-9 { top: 82%; left: 65%; animation: float-diag 21s infinite; }
.p-10 { top: 18%; left: 72%; animation: float-sway 27s infinite alternate; }

@keyframes glow-float { 0% { transform: translate(0, 0) scale(1); } 100% { transform: translate(8%, 5%) scale(1.1); } }
@keyframes float-diag { 0% { transform: translate(0, 0) rotate(0deg); opacity: 0.1; } 100% { transform: translate(30px, -50px) rotate(15deg); opacity: 0.15; } }
@keyframes float-sway { 0% { transform: translateY(0) rotate(-5deg); } 100% { transform: translateY(-40px) rotate(10deg); } }

/* Main Layout */
.portal-wrapper {
    height: 100vh;
    height: 100svh;
    display: flex;
    flex-direction: column;
    padding: clamp(0.5rem, 2vw, 1.5rem) clamp(1rem, 5vw, 4rem);
    max-width: 1440px;
    margin: 0 auto;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: clamp(0.5rem, 2vh, 1.5rem);
    flex-shrink: 0;
}

.brand-logotype { 
    font-size: clamp(1.8rem, 5vw, 2.5rem); 
    font-weight: 900; 
    letter-spacing: -0.05em; 
    color: var(--text-primary); 
    display: flex; 
    align-items: center; 
    gap: clamp(0.8rem, 2vw, 1.5rem);
    text-shadow: 0 4px 20px rgba(0,0,0,0.4);
    white-space: nowrap;
}
.brand-logotype span { 
    font-size: 0.85rem; 
    letter-spacing: 0.5em; 
    font-weight: 300; 
    text-transform: uppercase; 
    color: var(--text-secondary);
    opacity: 0.7;
}
.header-status { 
    font-size: 0.75rem; 
    color: var(--text-secondary); 
    display: flex; 
    align-items: center; 
    gap: 0.6rem; 
    white-space: nowrap; 
    flex-shrink: 0;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    opacity: 0.8;
}

@media (max-width: 900px) {
    .app-header { justify-content: center; margin-bottom: 4vh; }
    .header-status { display: none; }
    .brand-logotype span { display: none; }
    .view-grid { grid-template-columns: 1fr; gap: clamp(2rem, 5vh, 4rem); text-align: center; }
    .main-title { margin-bottom: 2rem; }
    .main-desc { margin-left: auto; margin-right: auto; margin-bottom: 3rem; max-width: 400px; }
    .system-stats { justify-content: center; gap: 2.5rem; margin-bottom: 2rem; }
    .portal-card { margin-top: 0; }
}

.status-indicator { 
    width: 6px; 
    height: 6px; 
    background: #10b981; 
    border-radius: 50%; 
    box-shadow: 0 0 12px #10b981; 
    animation: statusPulse 2s infinite alternate;
}
@keyframes statusPulse {
    from { opacity: 0.4; transform: scale(0.9); box-shadow: 0 0 4px #10b981; }
    to { opacity: 1; transform: scale(1.1); box-shadow: 0 0 15px #10b981; }
}

/* Content Grid */
.portal-content { flex: 1; display: flex; align-items: center; min-height: 0; }
.view-grid { width: 100%; display: grid; grid-template-columns: 1fr 420px; gap: 4rem; align-items: center; }

/* Branding */
.brand-eyebrow {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(248, 250, 252, 0.9);
    margin-bottom: 0.45rem;
}

.main-title { font-family: "Noto Serif SC", serif; font-size: clamp(2.5rem, 4.5vw, 4rem); font-weight: 600; line-height: 1.1; margin: 0 0 1.2rem; }
.main-desc { font-size: 1rem; line-height: 1.6; color: var(--text-secondary); margin-bottom: 2rem; max-width: 500px; }
.system-stats { display: flex; gap: 3rem; }
.stat-value { font-size: 1.8rem; font-weight: 800; }
.stat-label { font-size: 0.7rem; color: var(--text-secondary); text-transform: uppercase; }

/* Card */
.portal-card {
    width: 100%;
    max-width: 460px; /* Precise max-width to avoid stretching on iPad */
    margin: 0 auto;
    max-height: calc(100vh - 100px);
    background: #0f172a; 
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.6);
    border-radius: 1.2rem;
    padding: 2.2rem 2rem;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 10;
}

.portal-card.portal-stage-login #loginStage {
    display: block !important;
}

.portal-card.portal-stage-login #subjectStage {
    display: none !important;
}

.portal-card.portal-stage-subjects #loginStage {
    display: none !important;
}

.portal-card.portal-stage-subjects #subjectStage {
    display: flex !important;
}
/* Removed card::before ambient glows */

.stage {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: none;
}
.stage::-webkit-scrollbar { display: none; }

.card-progress { margin-bottom: 1rem; flex-shrink: 0; }
.step-indicator { display: flex; align-items: center; justify-content: center; gap: 1rem; }
.step { font-size: 0.7rem; font-weight: 800; color: var(--text-secondary); opacity: 0.6; }
.step.active { color: var(--accent-color); opacity: 1; }
.step-line { width: 40px; flex: none; height: 1px; background: var(--glass-border); }

/* Tabs */
.auth-tabs { 
    display: flex; 
    background: rgba(255, 255, 255, 0.03); 
    padding: 0.2rem; 
    border-radius: 0.8rem; 
    margin-bottom: 1.2rem; 
    border: 1px solid rgba(255, 255, 255, 0.02);
}
/* Layout Logic: Hide elements in registration mode */
#loginStage:has(#userRegisterForm:not([hidden])) .auth-tabs { display: none !important; }
/* Stage Headers */
.stage-header { text-align: center; margin-bottom: 1.8rem; width: 100%; }
.stage-header h2 { font-size: 1.8rem; font-weight: 800; margin-bottom: 0.2rem; font-family: "Noto Serif SC", serif; }
.stage-header p { font-size: 0.85rem; color: var(--text-secondary); margin: 0; opacity: 0.8; }

#loginStage:has(#userRegisterForm:not([hidden])) .stage-header { margin-bottom: 1rem; }
#subjectStage {
    display: flex;
    flex-direction: column;
    align-items: center;
}

#subjectStage .stage-header {
    max-width: 320px;
    margin: 0 auto 1.5rem;
}

#subjectStage .stage-header h2 {
    margin-bottom: 0.35rem;
}

#subjectStage .stage-header p {
    line-height: 1.6;
}

#subjectStage .subject-container {
    width: 100%;
}

.auth-tab { 
    flex: 1; 
    padding: 0.55rem; 
    color: var(--text-secondary); 
    font-size: 0.85rem; 
    font-weight: 700; 
    border-radius: 0.6rem; 
    transition: all 0.3s ease; 
    text-align: center; 
    cursor: pointer;
}
.auth-tab.active { 
    background: rgba(255, 255, 255, 0.08); 
    color: var(--text-primary); 
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* Form Elements */
.input-group { position: relative; margin-bottom: 1.2rem; }
.input-group input { 
    width: 100%; 
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0.5rem;
    padding: 1rem 0.8rem 0.5rem; 
    color: var(--text-primary); 
    font-size: 0.95rem; 
    transition: var(--transition-base);
}
.input-group input:focus {
    border-color: var(--accent-color);
    background: rgba(255, 255, 255, 0.05);
    outline: none;
}
.input-group label { 
    position: absolute; 
    left: 1rem; 
    top: 50%; 
    transform: translateY(-50%);
    color: var(--text-secondary); 
    font-size: 0.95rem; 
    pointer-events: none; 
    transition: var(--transition-base); 
}
.input-group input:focus + label, .input-group input:not(:placeholder-shown) + label { 
    top: 0.8rem; 
    font-size: 0.65rem; 
    color: var(--accent-color); 
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.input-group.input-plain input {
    padding: 0.95rem 1rem;
}

.input-group.input-plain input::placeholder {
    color: rgba(148, 163, 184, 0.8);
}

.form-utils { 
    display: flex; 
    justify-content: flex-end; 
    margin-top: -0.5rem; 
    margin-bottom: 1.5rem; 
}
.btn-link-sm { 
    font-size: 0.8rem; 
    color: var(--text-secondary); 
    opacity: 0.6; 
    text-decoration: none; 
    transition: all 0.3s ease;
    cursor: pointer;
}
.btn-link-sm:hover { 
    color: var(--accent-color); 
    opacity: 1; 
}

/* Action Buttons */
.btn-primary { 
    width: 100%; 
    padding: 0.85rem; 
    background: var(--accent-color);
    color: #0f172a; 
    border: none; 
    border-radius: 0.6rem; 
    font-weight: 700; 
    font-size: 0.95rem; 
    display: flex;
    justify-content: center;
    gap: 0.6rem;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.02em;
}
.btn-primary:hover { 
    filter: brightness(1.1);
    transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }

/* The fix for '立即注册' */
.btn-link {
    cursor: pointer;
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    color: var(--accent-color);
    font-weight: 800;
    font-size: 0.9rem;
    margin-left: 0.5rem;
    display: inline-block;
    transition: var(--transition-base);
    text-decoration: underline rgba(251, 191, 36, 0.2);
    text-underline-offset: 4px;
}
.btn-link:hover { opacity: 0.7; transform: translateX(2px); text-decoration-color: var(--accent-color); }

/* Registration Spacing Fix */
#userRegisterForm .input-group {
    margin-bottom: 0.4rem;
}

#userRegisterForm .btn-primary {
    margin-top: 0.8rem;
    padding: 0.8rem;
}

.form-footer { text-align: center; margin-top: 1rem; font-size: 0.9rem; color: var(--text-secondary); }
.feedback-msg {
    min-height: 1.35rem;
    margin-top: 0.9rem;
    font-size: 0.78rem;
    line-height: 1.5;
    color: var(--text-secondary);
    text-align: center;
}

/* Identity Selector for Register */
.identity-selector { display: flex; gap: 0.8rem; margin-bottom: 0.8rem; }
.id-btn { flex: 1; cursor: pointer; }
.id-btn input { display: none; }
.id-btn-content { 
    background: rgba(255, 255, 255, 0.03); 
    border: 1px solid var(--glass-border); 
    padding: 0.4rem; 
    border-radius: 0.6rem; 
    text-align: center; 
    font-size: 0.8rem; 
    color: var(--text-secondary); 
    transition: var(--transition-base); 
}
.id-btn input:checked + .id-btn-content { background: rgba(251, 191, 36, 0.1); border-color: var(--accent-color); color: var(--accent-color); font-weight: 800; }

/* Dynamic Layout Adjustments */
#loginStage:has(#userRegisterForm:not([hidden])) .auth-tabs { display: none; }

/* Subjects Selection Grid */
.subject-grid { 
    display: grid; 
    grid-template-columns: repeat(2, 1fr); 
    grid-auto-rows: 1fr; 
    gap: 1rem; 
    width: 100%;
    max-width: 360px;
    margin: 0.5rem auto 0;
}

/* 过渡线优化 */
.subject-divider {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin: 1.8rem 0;
    opacity: 0.4;
}

.subject-divider::before, .subject-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--glass-border), transparent);
}

.subject-divider span {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--text-secondary);
    white-space: nowrap;
    filter: brightness(0.8);
}

.special-entrance-container {
    display: grid; 
    grid-template-columns: 1fr; 
    grid-auto-rows: 1fr; 
    gap: 1rem; 
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    justify-content: center;
}

.special-entrance-container.special-entrance-dual {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.special-entrance-container.special-entrance-single {
    max-width: 360px;
}

.special-entrance-container .subject-card {
    width: 100%;
    margin: 0 auto;
}

.special-entrance-container .card-info {
    min-width: 0;
}

.subject-card-shortcut .card-title {
    font-size: 0.92rem;
    line-height: 1.35;
}

.subject-card-shortcut .card-meta {
    font-size: 0.72rem;
}

.subject-card-shortcut .card-note {
    font-size: 0.62rem;
}

.subject-card-single-line .card-title,
.subject-card-single-line .card-meta {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.subject-card { 
    display: flex; 
    flex-direction: column;
    align-items: center; 
    justify-content: center;
    text-align: center;
    gap: 0.85rem;
    background: rgba(255, 255, 255, 0.03); 
    border: 1px solid rgba(255, 255, 255, 0.08); 
    padding: 1.35rem 1.1rem; 
    border-radius: 1rem; 
    text-decoration: none; 
    transition: var(--transition-base); 
    position: relative;
    overflow: hidden;
    min-height: 104px; /* 设置统一的最小高度 */
}

.subject-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.05) 0%, transparent 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.subject-card:hover { 
    background: rgba(255, 255, 255, 0.07); 
    transform: translateY(-3px); 
    border-color: rgba(255, 255, 255, 0.2); 
    box-shadow: 0 10px 30px -10px rgba(0,0,0,0.5);
}

.subject-card:hover::before { opacity: 1; }

.subject-card.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(0.8);
}

.subject-card.card-highlight {
    border-color: var(--accent-color);
    background: rgba(251, 191, 36, 0.05);
}

.subject-card {
    gap: 0.72rem;
    padding: 1.25rem 1rem;
    border-radius: 1.05rem;
    min-height: 112px;
    width: 100%;
}

.subject-card-wide {
    min-height: 108px;
}

.card-membership {
    position: absolute;
    top: 0.7rem;
    right: 0.7rem;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 22px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 0.63rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    backdrop-filter: blur(12px);
    box-shadow: 0 10px 24px rgba(2, 6, 23, 0.2);
}

.card-membership.status-founding {
    background: rgba(251, 191, 36, 0.14);
    border: 1px solid rgba(251, 191, 36, 0.28);
    color: #fcd34d;
    text-shadow: none;
}

.card-membership.status-trial {
    background: rgba(168, 85, 247, 0.16);
    border: 1px solid rgba(168, 85, 247, 0.28);
    color: #e9d5ff;
}

.card-icon {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: var(--text-primary);
    flex-shrink: 0;
    transition: transform 0.4s ease;
    margin: 0 auto;
}

.card-icon {
    width: 46px;
    height: 46px;
}

.subject-card:hover .card-icon {
    transform: scale(1.1) rotate(5deg);
    background: rgba(255, 255, 255, 0.1);
}

.card-info {
    flex: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    gap: 0.15rem;
}

.card-info {
    gap: 0.2rem;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0; 
    line-height: 1.1;
}

.card-title {
    font-size: 1.05rem;
    line-height: 1.2;
}

.card-meta {
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    margin-top: 0;
    opacity: 0.7;
    text-align: center;
}

.card-meta {
    font-size: 0.76rem;
}

.card-note {
    font-size: 0.66rem;
    line-height: 1.2;
    color: rgba(148, 163, 184, 0.88);
    letter-spacing: 0.04em;
    text-align: center;
    margin-top: 0.08rem;
}

/* Membership Status Colors */
.status-founding { color: var(--accent-color); font-weight: 800; text-shadow: 0 0 15px rgba(251, 191, 36, 0.3); }
.status-trial { color: #a855f7; }
.status-regular { color: var(--text-secondary); opacity: 0.8; }
.status-online { color: #10b981; }
.status-planned { color: var(--text-secondary); opacity: 0.5; font-style: italic; }
.status-restricted { color: #ef4444; opacity: 0.8; }

.card-arrow { display: none; }

@media (max-width: 480px) {
    .subject-grid { grid-template-columns: 1fr; }
    .special-entrance-container { grid-template-columns: 1fr; }
}

.stage-actions {
    position: static;
    z-index: 20;
    width: 100%;
    display: flex;
    justify-content: center;
    margin-top: 1.5rem;
    margin-bottom: 0.25rem;
}

.stage-actions {
    margin-top: 1.15rem;
}

.stage-actions .btn-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

.subject-transfer-overlay {
    position: fixed;
    inset: 0;
    z-index: 2400;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.subject-transfer-overlay.is-visible {
    display: flex;
}

.subject-transfer-backdrop {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 18% 18%, rgba(56, 189, 248, 0.18) 0%, transparent 30%),
        radial-gradient(circle at 82% 14%, rgba(251, 191, 36, 0.14) 0%, transparent 26%),
        linear-gradient(180deg, rgba(2, 6, 23, 0.78) 0%, rgba(2, 8, 20, 0.88) 100%);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
}

.subject-transfer-card {
    position: relative;
    width: min(100%, 430px);
    padding: 1.8rem 1.5rem 1.5rem;
    border-radius: 1.6rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: linear-gradient(165deg, rgba(10, 18, 32, 0.96), rgba(8, 17, 30, 0.92) 52%, rgba(6, 13, 24, 0.98) 100%);
    box-shadow: 0 32px 90px rgba(0, 0, 0, 0.46);
    overflow: hidden;
    transform: translateY(18px) scale(0.98);
    opacity: 0;
    transition: transform 0.28s ease, opacity 0.28s ease;
}

.subject-transfer-overlay.is-active .subject-transfer-card {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.subject-transfer-glow {
    position: absolute;
    border-radius: 999px;
    pointer-events: none;
    filter: blur(30px);
}

.subject-transfer-glow-a {
    top: -48px;
    right: -30px;
    width: 180px;
    height: 180px;
    background: rgba(56, 189, 248, 0.18);
}

.subject-transfer-glow-b {
    left: -60px;
    bottom: -80px;
    width: 210px;
    height: 210px;
    background: rgba(251, 191, 36, 0.12);
}

.subject-transfer-visual {
    position: relative;
    width: 110px;
    height: 110px;
    margin: 0 auto 1.1rem;
}

.subject-transfer-orbit,
.subject-transfer-core-ring,
.subject-transfer-core {
    position: absolute;
    inset: 0;
    border-radius: 999px;
}

.subject-transfer-orbit-a {
    border: 1px solid rgba(56, 189, 248, 0.34);
    animation: subjectTransferSpin 4.6s linear infinite;
}

.subject-transfer-orbit-b {
    inset: 10px;
    border: 1px dashed rgba(251, 191, 36, 0.32);
    animation: subjectTransferSpinReverse 3.2s linear infinite;
}

.subject-transfer-core-ring {
    inset: 26px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: radial-gradient(circle, rgba(56, 189, 248, 0.12) 0%, transparent 68%);
}

.subject-transfer-core {
    inset: 38px;
    background: linear-gradient(135deg, #38bdf8 0%, #fbbf24 100%);
    box-shadow: 0 0 24px rgba(56, 189, 248, 0.26);
    animation: subjectTransferPulse 1.8s ease-in-out infinite;
}

.subject-transfer-kicker {
    position: relative;
    z-index: 1;
    text-align: center;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.28em;
    color: rgba(226, 232, 240, 0.72);
}

.subject-transfer-badge {
    position: relative;
    z-index: 1;
    width: fit-content;
    margin: 0.85rem auto 0;
    min-height: 2rem;
    padding: 0 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(226, 232, 240, 0.86);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
}

.subject-transfer-title {
    position: relative;
    z-index: 1;
    margin: 1rem 0 0;
    text-align: center;
    font-size: clamp(1.5rem, 3vw, 1.9rem);
    font-weight: 800;
    color: #f8fafc;
    font-family: "Noto Serif SC", serif;
}

.subject-transfer-desc {
    position: relative;
    z-index: 1;
    margin: 0.7rem auto 0;
    max-width: 300px;
    text-align: center;
    font-size: 0.88rem;
    line-height: 1.75;
    color: rgba(203, 213, 225, 0.78);
}

.subject-transfer-progress {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.55rem;
    margin-top: 1.35rem;
}

.subject-transfer-progress span {
    min-height: 2.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(226, 232, 240, 0.6);
    font-size: 0.73rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.subject-transfer-progress .is-done {
    border-color: rgba(52, 211, 153, 0.26);
    background: rgba(52, 211, 153, 0.1);
    color: #86efac;
}

.subject-transfer-progress .is-active {
    border-color: rgba(56, 189, 248, 0.3);
    background: rgba(56, 189, 248, 0.12);
    color: #bae6fd;
    box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.06), 0 10px 24px rgba(56, 189, 248, 0.1);
}

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

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

@keyframes subjectTransferPulse {
    0%, 100% { transform: scale(0.94); box-shadow: 0 0 24px rgba(56, 189, 248, 0.26); }
    50% { transform: scale(1.04); box-shadow: 0 0 34px rgba(251, 191, 36, 0.22); }
}

.portal-modal.hidden {
    display: none;
}

.portal-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
}

.portal-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(3, 7, 18, 0.82);
    backdrop-filter: blur(16px);
}

.portal-modal-card {
    position: relative;
    width: min(100%, 460px);
    padding: 1.6rem;
    border-radius: 1.2rem;
    background: rgba(15, 23, 42, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.48);
}

.portal-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.2rem;
}

.portal-modal-title {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text-primary);
    font-family: "Noto Serif SC", serif;
}

.portal-modal-subtitle {
    margin: 0.4rem 0 0;
    font-size: 0.82rem;
    line-height: 1.65;
    color: var(--text-secondary);
}

.portal-modal-close {
    width: 2.4rem;
    height: 2.4rem;
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: var(--transition-base);
}

.portal-modal-close:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.12);
}

.portal-modal-form .input-group {
    margin-bottom: 0.95rem;
}

.portal-modal-actions {
    display: flex;
    gap: 0.8rem;
    margin-top: 1.1rem;
}

.portal-modal-actions .btn-primary,
.portal-modal-actions .btn-secondary {
    flex: 1;
}

.btn-secondary {
    width: 100%;
    padding: 0.85rem;
    border-radius: 0.6rem;
    font-weight: 700;
    font-size: 0.92rem;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-1px);
}

/* Footer */
.app-footer { margin-top: auto; padding: 2rem 0; border-top: 1px solid var(--glass-border); color: var(--text-secondary); font-size: 0.8rem; }
.footer-links { display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; }
.footer-links a { color: var(--text-secondary); text-decoration: none; transition: var(--transition-base); }
.footer-links a:hover { color: var(--text-primary); text-shadow: 0 0 10px rgba(255,255,255,0.3); }
.sep { color: rgba(255,255,255,0.1); }

/* Mobile */
@media (max-width: 900px) {
    html, body { overflow: hidden !important; }
    .portal-wrapper { height: 100svh; padding: 1rem; }
    .view-grid { grid-template-columns: 1fr; gap: 1.5rem; }
    .branding-panel { text-align: center; }
    .main-title { font-size: 2.22rem; }
    .main-desc, .system-stats, .app-footer, .symbol { display: none; }
    .portal-card { max-width: 440px; }
    .portal-modal-card { padding: 1.35rem; }
    .portal-modal-actions { flex-direction: column-reverse; }

    /* 手机端更换账号按钮居中并消除重叠 */
    .stage-actions {
        position: static;
        text-align: center;
        margin-top: 1.5rem;
        margin-bottom: 0.5rem;
        width: 100%;
    }

    .subject-transfer-card {
        padding: 1.55rem 1.2rem 1.25rem;
        border-radius: 1.35rem;
    }

    .subject-transfer-progress {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .portal-card {
        padding: 1.85rem 1.25rem 1.45rem;
    }

    .card-progress {
        margin-bottom: 0.85rem;
    }

    .step-indicator {
        gap: 0.75rem;
    }

    .step {
        font-size: 0.66rem;
    }

    .step-line {
        width: 32px;
    }

    .stage-actions {
        margin-top: 1.15rem;
        margin-bottom: 0.35rem;
    }
}

@media (max-width: 380px) {
    .portal-card {
        padding: 1.65rem 1rem 1.35rem;
    }

    #subjectStage .stage-header {
        max-width: 290px;
        margin-bottom: 1.3rem;
    }

    .subject-grid {
        grid-template-columns: 1fr;
        gap: 0.85rem;
    }

    .special-entrance-container {
        gap: 0.85rem;
    }

    .subject-card,
    .subject-card-wide {
        min-height: 104px;
    }
}

@media (max-width: 600px) {
    .portal-wrapper {
        padding: 0.75rem 0.85rem;
    }

    .app-header {
        margin-bottom: 0.75rem;
    }

    .brand-logotype {
        font-size: 1.45rem;
        gap: 0.55rem;
    }

    .view-grid {
        gap: 0.9rem;
    }

    .main-title {
        font-size: 1.92rem;
        line-height: 1.08;
        margin-bottom: 0.75rem;
    }

    .portal-card {
        max-width: 410px;
        max-height: calc(100svh - 64px);
        padding: 1.2rem 0.95rem 0.95rem;
        border-radius: 1rem;
    }

    .card-progress {
        margin-bottom: 0.65rem;
    }

    .step-indicator {
        gap: 0.55rem;
    }

    .step {
        font-size: 0.62rem;
    }

    .step-line {
        width: 24px;
    }

    .stage-header {
        margin-bottom: 1.15rem;
    }

    .stage-header h2 {
        font-size: 1.55rem;
    }

    .stage-header p {
        font-size: 0.78rem;
    }

    #subjectStage .stage-header {
        max-width: 280px;
        margin-bottom: 1rem;
    }

    .subject-grid {
        max-width: 332px;
        gap: 0.75rem;
        margin-top: 0.25rem;
    }

    .special-entrance-container {
        max-width: 332px;
        gap: 0.75rem;
    }

    .subject-divider {
        gap: 1rem;
        margin: 1.05rem 0;
    }

    .subject-card,
    .subject-card-wide {
        min-height: 88px;
        padding: 0.9rem 0.8rem;
        gap: 0.55rem;
    }

    .card-membership {
        top: 0.55rem;
        right: 0.55rem;
        padding: 3px 7px;
        font-size: 0.58rem;
    }

    .card-icon {
        width: 38px;
        height: 38px;
        font-size: 1.2rem;
        border-radius: 0.75rem;
    }

    .card-title {
        font-size: 0.98rem;
        line-height: 1.15;
    }

    .card-meta {
        font-size: 0.7rem;
    }

    .card-note {
        font-size: 0.6rem;
    }

    .stage-actions {
        margin-top: 0.75rem;
        margin-bottom: 0.1rem;
    }

    .portal-wrapper:has(#userRegisterForm:not([hidden])) .portal-content {
        align-items: flex-start;
    }

    .portal-wrapper:has(#userRegisterForm:not([hidden])) .view-grid {
        gap: 0.7rem;
    }

    .portal-wrapper:has(#userRegisterForm:not([hidden])) .brand-eyebrow {
        font-size: 0.66rem;
        margin-bottom: 0.2rem;
    }

    .portal-wrapper:has(#userRegisterForm:not([hidden])) .main-title {
        font-size: 1.7rem;
        margin-bottom: 0.35rem;
        max-width: 260px;
    }

    .portal-wrapper:has(#userRegisterForm:not([hidden])) .portal-card {
        max-height: calc(100svh - 28px);
        padding: 0.98rem 0.9rem 0.88rem;
    }

    .portal-wrapper:has(#userRegisterForm:not([hidden])) .card-progress {
        margin-bottom: 0.45rem;
    }

    .portal-wrapper:has(#userRegisterForm:not([hidden])) .step-indicator {
        gap: 0.38rem;
    }

    .portal-wrapper:has(#userRegisterForm:not([hidden])) .step {
        font-size: 0.56rem;
    }

    .portal-wrapper:has(#userRegisterForm:not([hidden])) .step-line {
        width: 18px;
    }

    .portal-wrapper:has(#userRegisterForm:not([hidden])) .stage-header {
        margin-bottom: 0.72rem;
    }

    .portal-wrapper:has(#userRegisterForm:not([hidden])) .stage-header h2 {
        font-size: 1.34rem;
        margin-bottom: 0.12rem;
    }

    .portal-wrapper:has(#userRegisterForm:not([hidden])) .stage-header p {
        font-size: 0.7rem;
        line-height: 1.45;
    }

    .portal-wrapper:has(#userRegisterForm:not([hidden])) .identity-selector {
        gap: 0.55rem;
        margin-bottom: 0.55rem;
    }

    .portal-wrapper:has(#userRegisterForm:not([hidden])) .id-btn-content {
        min-height: 44px;
        padding: 0.35rem 0.5rem;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 0.76rem;
        border-radius: 0.7rem;
    }

    .portal-wrapper:has(#userRegisterForm:not([hidden])) #userRegisterForm .input-group {
        margin-bottom: 0.32rem;
    }

    .portal-wrapper:has(#userRegisterForm:not([hidden])) #userRegisterForm .input-group.input-plain input {
        min-height: 48px;
        padding: 0.82rem 0.95rem;
        font-size: 0.9rem;
    }

    .portal-wrapper:has(#userRegisterForm:not([hidden])) #userRegisterForm .btn-primary {
        margin-top: 0.5rem;
        padding: 0.82rem;
        font-size: 0.92rem;
    }

    .portal-wrapper:has(#userRegisterForm:not([hidden])) #userRegisterForm .form-footer {
        margin-top: 0.72rem;
        font-size: 0.82rem;
    }

    .portal-wrapper:has(#userRegisterForm:not([hidden])) #userRegisterForm .btn-link {
        font-size: 0.84rem;
    }
}

@media (max-width: 600px) and (min-height: 820px) {
    .portal-content {
        align-items: stretch;
    }

    .view-grid {
        min-height: 100%;
        grid-template-rows: auto minmax(0, 1fr);
        align-content: stretch;
        gap: 1rem;
    }

    .branding-panel {
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
    }

    .action-panel {
        display: flex;
        align-items: center;
        justify-content: center;
        padding-top: 0;
        padding-bottom: clamp(0.4rem, 1.6vh, 0.9rem);
    }

    .portal-card {
        margin: 0 auto;
    }
}

@media (max-width: 480px) and (min-width: 421px) {
    .portal-wrapper {
        padding: 0.6rem 0.75rem;
    }

    .app-header {
        margin-bottom: 0.6rem;
    }

    .portal-content {
        align-items: flex-start;
    }

    .view-grid {
        gap: 0.7rem;
        justify-items: center;
    }

    .branding-panel,
    .action-panel {
        width: 100%;
    }

    .branding-panel {
        display: flex;
        justify-content: center;
    }

    .brand-content {
        width: min(100%, 320px);
        margin: 0 auto;
    }

    .brand-eyebrow {
        font-size: 0.72rem;
        margin-bottom: 0.28rem;
    }

    .main-title {
        font-size: 1.64rem;
        line-height: 1.04;
        margin: 0 auto 0.35rem;
        max-width: 300px;
    }

    .portal-card {
        max-width: 380px;
        max-height: calc(100svh - 52px);
        padding: 0.98rem 0.84rem 0.8rem;
        border-radius: 0.95rem;
    }

    .stage-header {
        margin-bottom: 0.9rem;
    }

    #subjectStage .stage-header {
        max-width: 260px;
        margin-bottom: 0.88rem;
    }

    .subject-grid {
        max-width: 320px;
        gap: 0.65rem;
    }

    .special-entrance-container {
        max-width: 320px;
        gap: 0.65rem;
    }
}

@media (max-width: 420px), (max-width: 600px) and (max-height: 740px) {
    .portal-wrapper {
        padding: 0.45rem 0.6rem;
    }

    .app-header {
        margin-bottom: 0.45rem;
    }

    .brand-logotype {
        font-size: 1.18rem;
        gap: 0.4rem;
    }

    .portal-content {
        align-items: flex-start;
    }

    .view-grid {
        gap: 0.45rem;
    }

    .branding-panel {
        padding-top: 0.05rem;
    }

    .brand-eyebrow {
        font-size: 0.68rem;
        letter-spacing: 0.16em;
        margin-bottom: 0.22rem;
    }

    .main-title {
        font-size: 1.48rem;
        line-height: 1.02;
        margin: 0 auto 0.25rem;
        max-width: 280px;
    }

    .portal-card {
        max-width: 352px;
        max-height: calc(100svh - 42px);
        padding: 0.82rem 0.72rem 0.68rem;
        border-radius: 0.9rem;
    }

    .card-progress {
        margin-bottom: 0.42rem;
    }

    .step-indicator {
        gap: 0.34rem;
    }

    .step {
        font-size: 0.54rem;
    }

    .step-line {
        width: 16px;
    }

    .stage-header {
        margin-bottom: 0.75rem;
    }

    .stage-header h2 {
        font-size: 1.28rem;
        margin-bottom: 0.15rem;
    }

    .stage-header p {
        font-size: 0.7rem;
    }

    #subjectStage .stage-header {
        max-width: 238px;
        margin-bottom: 0.72rem;
    }

    .subject-grid {
        max-width: 286px;
        gap: 0.52rem;
        margin-top: 0.1rem;
    }

    .special-entrance-container {
        max-width: 286px;
        gap: 0.52rem;
    }

    .subject-divider {
        gap: 0.75rem;
        margin: 0.7rem 0;
    }

    .subject-divider span {
        font-size: 0.5rem;
        letter-spacing: 0.16em;
    }

    .subject-card,
    .subject-card-wide {
        min-height: 72px;
        padding: 0.66rem 0.58rem;
        gap: 0.38rem;
        border-radius: 0.88rem;
    }

    .card-membership {
        top: 0.42rem;
        right: 0.42rem;
        padding: 2px 6px;
        font-size: 0.54rem;
    }

    .card-icon {
        width: 30px;
        height: 30px;
        font-size: 0.95rem;
        border-radius: 0.58rem;
    }

    .card-title {
        font-size: 0.84rem;
        line-height: 1.1;
    }

    .card-meta {
        font-size: 0.6rem;
    }

    .card-note {
        font-size: 0.52rem;
        letter-spacing: 0.03em;
    }

    .stage-actions {
        margin-top: 0.45rem;
        margin-bottom: 0;
    }

    .stage-actions .btn-link {
        font-size: 0.78rem;
    }

    .portal-wrapper:has(#userRegisterForm:not([hidden])) .view-grid {
        gap: 0.3rem;
    }

    .portal-wrapper:has(#userRegisterForm:not([hidden])) .brand-eyebrow {
        font-size: 0.6rem;
        margin-bottom: 0.14rem;
    }

    .portal-wrapper:has(#userRegisterForm:not([hidden])) .main-title {
        font-size: 1.34rem;
        margin: 0 auto 0.18rem;
        max-width: 220px;
    }

    .portal-wrapper:has(#userRegisterForm:not([hidden])) .portal-card {
        max-width: 344px;
        max-height: calc(100svh - 18px);
        padding: 0.72rem 0.68rem 0.62rem;
    }

    .portal-wrapper:has(#userRegisterForm:not([hidden])) .card-progress {
        margin-bottom: 0.34rem;
    }

    .portal-wrapper:has(#userRegisterForm:not([hidden])) .step-indicator {
        gap: 0.26rem;
    }

    .portal-wrapper:has(#userRegisterForm:not([hidden])) .step {
        font-size: 0.5rem;
    }

    .portal-wrapper:has(#userRegisterForm:not([hidden])) .step-line {
        width: 12px;
    }

    .portal-wrapper:has(#userRegisterForm:not([hidden])) .stage-header {
        margin-bottom: 0.56rem;
    }

    .portal-wrapper:has(#userRegisterForm:not([hidden])) .stage-header h2 {
        font-size: 1.12rem;
        margin-bottom: 0.1rem;
    }

    .portal-wrapper:has(#userRegisterForm:not([hidden])) .stage-header p {
        font-size: 0.64rem;
    }

    .portal-wrapper:has(#userRegisterForm:not([hidden])) .identity-selector {
        gap: 0.45rem;
        margin-bottom: 0.45rem;
    }

    .portal-wrapper:has(#userRegisterForm:not([hidden])) .id-btn-content {
        min-height: 40px;
        padding: 0.3rem 0.42rem;
        font-size: 0.72rem;
        border-radius: 0.62rem;
    }

    .portal-wrapper:has(#userRegisterForm:not([hidden])) #userRegisterForm .input-group {
        margin-bottom: 0.26rem;
    }

    .portal-wrapper:has(#userRegisterForm:not([hidden])) #userRegisterForm .input-group.input-plain input {
        min-height: 44px;
        padding: 0.72rem 0.86rem;
        font-size: 0.86rem;
        border-radius: 0.82rem;
    }

    .portal-wrapper:has(#userRegisterForm:not([hidden])) #userRegisterForm .btn-primary {
        margin-top: 0.42rem;
        padding: 0.74rem;
        font-size: 0.88rem;
    }

    .portal-wrapper:has(#userRegisterForm:not([hidden])) #userRegisterForm .form-footer {
        margin-top: 0.56rem;
        font-size: 0.78rem;
    }

    .portal-wrapper:has(#userRegisterForm:not([hidden])) #userRegisterForm .btn-link {
        font-size: 0.8rem;
    }
}
