/* 猿辅导 · AI 交互课堂视觉主题（参考玻璃拟态 + 橙光科幻背景） */

.portal-ai-shell {
    --accent-color: #ff7a18;
    --accent-strong: #f06700;
    --glass-bg: rgba(255, 247, 240, 0.16);
    --glass-border: rgba(255, 255, 255, 0.32);
    --glass-shadow: 0 28px 80px rgba(0, 0, 0, 0.28);
    --portal-font: "PingFang SC", "Microsoft YaHei", "HarmonyOS Sans SC", "Segoe UI", sans-serif;
    font-family: var(--portal-font);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

.portal-ai-shell :where(
    h1, h2, h3, h4,
    p, span, strong, em, a, button, input, label, li,
    .main-title, .title-line, .brand-tag, .main-desc,
    .brand-highlights, .stat-item,
    .portal-card, .stage-header, .auth-tab, .btn-primary,
    .portal-bottom-bar, .app-footer, .ai-tools-section
) {
    font-family: var(--portal-font) !important;
}

.portal-ai-shell .noise-overlay {
    opacity: 0.015;
}

.portal-ai-shell .cursor-glow {
    background: radial-gradient(circle, rgba(255, 122, 24, 0.12) 0%, transparent 70%);
}

.portal-ai-shell .visual-canvas {
    background-color: #080402;
}

.portal-ai-shell .bg-photo-wrap,
.portal-ai-shell .bg-photo {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.portal-ai-shell .bg-photo {
    object-fit: cover;
    object-position: center center;
    width: 100%;
    height: 100%;
    min-width: 100%;
    min-height: 100%;
    filter: saturate(1.08) contrast(1.05) brightness(0.98);
    transform: none !important;
}

.portal-ai-shell .video-overlay {
    background:
        linear-gradient(
            90deg,
            rgba(8, 4, 2, 0.35) 0%,
            rgba(8, 4, 2, 0.15) 24%,
            rgba(8, 4, 2, 0.03) 48%,
            rgba(8, 4, 2, 0.02) 68%,
            rgba(8, 4, 2, 0.1) 100%
        ),
        linear-gradient(
            180deg,
            rgba(8, 4, 2, 0.15) 0%,
            transparent 38%,
            rgba(8, 4, 2, 0.08) 100%
        );
}

.portal-ai-shell .visual-canvas::after {
    display: none;
}

.portal-ai-shell .ambient-glow {
    opacity: 0.16;
}

.portal-ai-shell .portal-wrapper {
    max-width: 1560px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    margin: 0 auto !important;
}

.portal-ai-shell .portal-topbrand {
    position: fixed;
    top: 35px;
    left: 40px;
    z-index: 40;
    display: grid !important;
    grid-template-columns: 52px auto;
    grid-template-rows: 36px 20px;
    column-gap: 13px;
    row-gap: 4px;
    align-items: center;
    width: max-content;
    max-width: min(34rem, calc(100vw - 5rem));
    color: #fff1df;
    background: transparent;
    box-shadow: none;
    pointer-events: none;
}

.portal-ai-shell .portal-topbrand::after {
    content: none;
}

.portal-ai-shell .portal-topbrand-mark {
    grid-column: 1;
    grid-row: 1 / span 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 8px;
    overflow: hidden;
    background: transparent;
    box-shadow: none;
}

.portal-ai-shell .yuanfudao-logo-icon {
    display: block;
    width: 52px;
    height: 52px;
}

.portal-ai-shell .portal-topbrand-copy {
    display: contents;
}

.portal-ai-shell .portal-topbrand-copy strong {
    grid-column: 2;
    grid-row: 1;
    align-self: end;
    font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", "Source Han Sans SC", sans-serif !important;
    font-size: clamp(27px, 2.25vw, 34px);
    line-height: 36px;
    font-weight: 900;
    color: #fff2df;
    letter-spacing: -0.018em;
    text-shadow:
        0 2px 8px rgba(0, 0, 0, 0.72),
        0 0 1px rgba(255, 242, 223, 0.7);
    white-space: nowrap;
}

.portal-ai-shell .portal-topbrand-copy span {
    grid-column: 2;
    grid-row: 2;
    justify-self: start;
    align-self: start;
    margin-left: 0;
    font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", "Source Han Sans SC", sans-serif !important;
    font-size: clamp(10px, 0.82vw, 12px);
    line-height: 18px;
    font-weight: 700;
    color: #fff2df;
    letter-spacing: 0.18em;
    text-shadow:
        0 2px 7px rgba(0, 0, 0, 0.75),
        0 0 1px rgba(255, 242, 223, 0.65);
    white-space: nowrap;
}

@media (max-width: 900px) {
    .portal-ai-shell .portal-topbrand {
        top: 1.05rem;
        left: 1.15rem;
        transform: scale(0.82);
        transform-origin: top left;
    }
}

@media (max-width: 520px) {
    .portal-ai-shell .portal-topbrand {
        top: max(0.78rem, env(safe-area-inset-top));
        left: 0.8rem;
        transform: scale(0.68);
    }
}
.portal-ai-shell .portal-content {
    flex: 1;
    display: flex;
    align-items: center;
    min-height: 0;
    padding-top: clamp(0.25rem, 1.5vh, 1.25rem);
}

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

.portal-ai-shell .view-grid {
    grid-template-columns: minmax(0, 1.05fr) min(400px, 34vw);
    gap: clamp(2rem, 4vw, 4.5rem);
    align-items: center;
    width: 100%;
    transform: translateY(-3vh);
}

.portal-ai-shell .portal-wrapper:has(#userRegisterForm:not([hidden])) .view-grid {
    align-items: center;
    gap: clamp(2rem, 4vw, 4.5rem);
}

.portal-ai-shell .branding-panel {
    align-self: center;
}

.portal-ai-shell .portal-wrapper:has(.portal-stage-subjects) .view-grid {
    grid-template-columns: minmax(0, 1.05fr) min(520px, 42vw);
}

.portal-ai-shell .brand-content {
    width: min(100%, 34rem);
    transform: translateX(42px);
}

.portal-ai-shell .title-head {
    max-width: 100%;
    margin-bottom: 0.85rem;
}

.portal-ai-shell h1.main-title {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    width: fit-content;
    max-width: 100%;
    margin: 0;
    font-family: var(--portal-font) !important;
    font-weight: 800;
    font-size: inherit;
    line-height: 1.05;
    mix-blend-mode: normal !important;
    text-shadow: none !important;
    background: none !important;
    -webkit-text-fill-color: initial !important;
    color: inherit;
    letter-spacing: 0;
    font-synthesis: weight;
}

.portal-ai-shell .title-top-row {
    display: inline-flex;
    align-items: center;
    gap: 0.42rem;
    max-width: 100%;
    margin-bottom: 0.12rem;
}

.portal-ai-shell .title-brand-stack {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    width: fit-content;
    max-width: 100%;
}

.portal-ai-shell .title-line-brand {
    font-size: clamp(2.18rem, 3.72vw, 3.46rem);
    font-weight: 900;
    line-height: 1;
    font-style: italic;
    transform: skewX(-8deg);
    transform-origin: left center;
    background: linear-gradient(180deg, #ffffff 0%, #fff3df 42%, #ffd49a 76%, #ffb35e 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 6px 20px rgba(0, 0, 0, 0.4));
    white-space: nowrap;
    letter-spacing: 0.02em;
}

.portal-ai-shell .brand-tag {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.58rem 1.6rem;
    border: 1px solid rgba(240, 178, 92, 0.55);
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(58, 36, 18, 0.92) 0%, rgba(26, 15, 7, 0.95) 100%);
    color: #fff2df;
    font-size: clamp(1.12rem, 1.5vw, 1.35rem);
    font-weight: 600;
    letter-spacing: 0.05em;
    white-space: nowrap;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 6px 16px rgba(0, 0, 0, 0.32);
    line-height: 1.2;
}

.portal-ai-shell .title-brand-tag {
    display: inline-flex;
    width: fit-content;
    align-self: flex-start;
    margin: 0 0 0.58rem;
    padding: 0.42rem 1.18rem;
    font-size: clamp(0.82rem, 1.04vw, 0.96rem);
    letter-spacing: 0.04em;
}

.portal-ai-shell .brand-tag-x {
    margin: 0 0.5em;
    font-style: normal;
    font-weight: 400;
    color: #ff9a3c;
}

.portal-ai-shell .title-line-accent {
    display: block;
    margin-top: 0.02rem;
    font-size: clamp(3.35rem, 6.8vw, 6rem);
    font-weight: 900;
    line-height: 1;
    letter-spacing: 0.03em;
    font-style: italic;
    transform: skewX(-8deg);
    transform-origin: left center;
    background: linear-gradient(180deg, #fff4df 0%, #ffc56a 18%, #ff9a2e 52%, #ff6a00 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 6px 18px rgba(255, 106, 0, 0.28));
}

.portal-ai-shell .title-line {
    display: block;
}

.portal-ai-shell .main-desc {
    max-width: 100%;
    margin-bottom: 0.85rem;
    font-size: clamp(0.88rem, 1.25vw, 1rem);
    line-height: 1.7;
    color: rgba(255, 236, 214, 0.86);
    text-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
}

.portal-ai-shell .brand-divider {
    width: min(100%, 520px);
    height: 1px;
    margin: 0 0 1rem;
    background: linear-gradient(
        90deg,
        rgba(255, 184, 92, 0.15) 0%,
        rgba(255, 210, 130, 0.82) 42%,
        rgba(255, 184, 92, 0.82) 58%,
        rgba(255, 184, 92, 0.15) 100%
    );
    box-shadow: 0 0 10px rgba(255, 170, 80, 0.22);
}

.portal-ai-shell .brand-highlights {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem 1.75rem;
    margin: 0 0 1.45rem;
    padding: 0;
    list-style: none;
}

.portal-ai-shell .brand-highlights li {
    display: inline-flex;
    align-items: center;
    gap: 0.42rem;
    color: rgba(255, 244, 230, 0.9);
    font-size: clamp(0.78rem, 1vw, 0.86rem);
    font-weight: 600;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.portal-ai-shell .highlight-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.15rem;
    height: 1.15rem;
    border-radius: 0;
    background: transparent;
    color: #ff9a3c;
}

.portal-ai-shell .highlight-icon svg {
    width: 1.05rem;
    height: 1.05rem;
}

.portal-ai-shell .feature-pills {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.6rem;
    width: min(100%, 580px);
    max-width: 100%;
    margin-top: 0;
}

.portal-ai-shell .feature-pills .stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.18rem;
    padding: 0.78rem 0.7rem;
    border-radius: 12px;
    background: rgba(18, 10, 5, 0.12); /* Extremely transparent warm glass */
    border: 1px solid rgba(255, 247, 240, 0.08); /* More subtle elegant border */
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    white-space: normal;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.portal-ai-shell .feature-pills .stat-item:hover {
    background: rgba(255, 138, 45, 0.08);
    border-color: rgba(255, 138, 45, 0.25);
    transform: translateY(-2px);
}

.portal-ai-shell .feature-pills .stat-item::before {
    display: none;
}

.portal-ai-shell .feature-pills .stat-value {
    font-size: 0.96rem;
    font-weight: 800;
    color: #fff7ed;
}

.portal-ai-shell .feature-pills .stat-label {
    font-size: 0.68rem;
    line-height: 1.4;
    color: rgba(255, 236, 214, 0.64);
    text-transform: none;
    letter-spacing: 0.02em;
}

.portal-ai-shell .portal-card {
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 236, 214, 0.7);
    width: 100%;
    max-width: 400px;
    padding: 1.65rem 1.5rem 1.45rem;
    color: var(--text-primary);
    background: rgba(18, 10, 5, 0.38);
    backdrop-filter: blur(24px) saturate(150%);
    -webkit-backdrop-filter: blur(24px) saturate(150%);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 24px;
    box-shadow:
        0 32px 80px rgba(0, 0, 0, 0.42),
        inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.portal-ai-shell .portal-card.portal-stage-subjects {
    max-width: 400px;
    padding: 1.65rem 1.5rem 1.45rem;
}

.portal-ai-shell .portal-card::before {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.09) 0%, transparent 50%);
}

.portal-ai-shell .action-panel {
    display: flex;
    justify-content: flex-end;
    align-self: center;
}

.portal-ai-shell .portal-wrapper:has(#userRegisterForm:not([hidden])) .portal-card {
    max-height: calc(100vh - 7.5rem);
    overflow-y: auto;
    padding: 1.65rem 1.5rem 1.45rem;
}

.portal-ai-shell .card-progress {
    display: none;
}

.portal-ai-shell .stage-header-ref {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    text-align: left;
    margin-bottom: 1.25rem;
}

.portal-ai-shell .stage-header-main h2 {
    font-family: var(--portal-font) !important;
    font-size: 1.72rem;
    font-weight: 800;
    color: #ffffff;
    margin: 0 0 0.35rem;
    letter-spacing: 0.02em;
    text-shadow: 0 2px 10px rgba(255, 122, 24, 0.15);
}

.portal-ai-shell #loginStage .stage-header {
    text-align: center;
    margin-bottom: 1.25rem;
}

.portal-ai-shell #loginStage .stage-header-ref {
    justify-content: center;
    text-align: center;
}

.portal-ai-shell #loginStage .stage-header-main {
    width: 100%;
    text-align: center;
}

.portal-ai-shell #loginStage .stage-header-main h2,
.portal-ai-shell #loginStage .stage-header h2 {
    font-family: var(--portal-font) !important;
    font-size: 1.65rem;
    font-weight: 800;
    line-height: 1.25;
    background: linear-gradient(135deg, #ffffff 0%, #ffe8d6 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0 0 0.42rem;
    letter-spacing: 0.03em;
    text-align: center;
}

.portal-ai-shell #loginStage .stage-hint,
.portal-ai-shell #loginStage .stage-header p {
    margin: 0;
    font-size: 0.82rem;
    font-weight: 500;
    line-height: 1.55;
    color: rgba(255, 236, 214, 0.7);
    letter-spacing: 0.02em;
}

.portal-ai-shell .stage-hint {
    margin: 0;
    font-size: 0.82rem;
    line-height: 1.55;
    color: rgba(255, 236, 214, 0.7);
}

.portal-ai-shell .stage-feedback {
    margin: 0.35rem 0 0;
    font-size: 0.82rem;
    line-height: 1.55;
    color: rgba(255, 236, 214, 0.7);
}

.portal-ai-shell .grade-switch {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    font-size: 0.72rem;
    color: rgba(255, 236, 214, 0.6);
    white-space: nowrap;
}

.portal-ai-shell .grade-switch .active {
    color: #ffffff;
    font-weight: 700;
}

.portal-ai-shell .grade-divider {
    opacity: 0.35;
}

.portal-ai-shell .auth-tabs {
    margin-bottom: 1.1rem;
    padding: 0.25rem;
    background: rgba(0, 0, 0, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 14px;
    display: flex;
    gap: 2px;
}

.portal-ai-shell .auth-tab {
    flex: 1;
    padding: 0.62rem 0.5rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: rgba(255, 236, 214, 0.65);
    border-radius: 11px;
    letter-spacing: 0.04em;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.portal-ai-shell .auth-tab:hover:not(.active) {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
}

.portal-ai-shell .auth-tab.active {
    background: rgba(255, 255, 255, 0.22);
    color: #ffffff;
    font-weight: 700;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.portal-ai-shell #loginStage .input-group {
    margin-bottom: 0.85rem;
}

.portal-ai-shell .input-group.input-plain input,
.portal-ai-shell #loginStage .input-group.input-plain input,
.portal-ai-shell #userRegisterForm .input-group.input-plain input {
    padding: 0.92rem 1.05rem;
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.4;
    background: rgba(0, 0, 0, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 12px;
    color: #ffffff;
    letter-spacing: 0.02em;
    transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.portal-ai-shell .input-group.input-plain input::placeholder,
.portal-ai-shell #loginStage .input-group.input-plain input::placeholder,
.portal-ai-shell #userRegisterForm .input-group.input-plain input::placeholder {
    color: rgba(255, 236, 214, 0.45);
    font-weight: 500;
}

.portal-ai-shell .input-group.input-plain input:focus,
.portal-ai-shell #loginStage .input-group.input-plain input:focus,
.portal-ai-shell #userRegisterForm .input-group.input-plain input:focus {
    border-color: rgba(255, 122, 24, 0.8);
    background: rgba(0, 0, 0, 0.28);
    box-shadow: 0 0 15px rgba(255, 122, 24, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.portal-ai-shell #loginStage .form-utils {
    margin-top: -0.15rem;
    margin-bottom: 1.1rem;
}

.portal-ai-shell #loginStage .btn-link-sm {
    font-size: 0.78rem;
    font-weight: 600;
    color: #ff9d42;
    text-decoration: none;
    opacity: 0.85;
    transition: all 0.2s ease;
}

.portal-ai-shell #loginStage .btn-link-sm:hover {
    color: #ffb36e;
    opacity: 1;
    text-shadow: 0 0 8px rgba(255, 157, 66, 0.4);
}

.portal-ai-shell .btn-link-sm,
.portal-ai-shell .btn-link {
    color: #ff9d42;
}

.portal-ai-shell .btn-primary,
.portal-ai-shell #loginStage .btn-primary,
.portal-ai-shell #userRegisterForm .btn-primary {
    margin-top: 0.75rem;
    padding: 0.92rem 1.25rem;
    font-size: 0.98rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, #ff9d42 0%, #ff6a00 100%);
    color: #ffffff;
    box-shadow: 0 8px 24px rgba(255, 106, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.portal-ai-shell .btn-primary:hover,
.portal-ai-shell #loginStage .btn-primary:hover,
.portal-ai-shell #userRegisterForm .btn-primary:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
    box-shadow: 0 12px 28px rgba(255, 106, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.portal-ai-shell .btn-primary:active,
.portal-ai-shell #loginStage .btn-primary:active,
.portal-ai-shell #userRegisterForm .btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 6px 16px rgba(255, 106, 0, 0.4);
}

.portal-ai-shell #loginStage .btn-primary svg {
    width: 1.3rem;
    height: 1.3rem;
    padding: 0.18rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.22);
    flex-shrink: 0;
}

.portal-ai-shell #loginStage .form-footer,
.portal-ai-shell #userRegisterForm .form-footer {
    margin-top: 0.95rem;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.5;
    color: rgba(255, 236, 214, 0.65);
    letter-spacing: 0.02em;
    text-align: center;
}

.portal-ai-shell #loginStage .form-footer .btn-link,
.portal-ai-shell #userRegisterForm .form-footer .btn-link {
    font-size: 0.8rem;
    font-weight: 700;
    color: #ff9d42;
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: all 0.2s ease;
}

.portal-ai-shell #loginStage .form-footer .btn-link:hover,
.portal-ai-shell #userRegisterForm .form-footer .btn-link:hover {
    color: #ffb36e;
    text-shadow: 0 0 8px rgba(255, 157, 66, 0.4);
}

.portal-ai-shell #loginStage:has(#userRegisterForm:not([hidden])) .stage-header {
    margin-bottom: 1.1rem;
}

.portal-ai-shell #loginStage:has(#userRegisterForm:not([hidden])) .stage-header-main h2,
.portal-ai-shell #loginStage:has(#userRegisterForm:not([hidden])) .stage-header h2 {
    font-size: 1.58rem;
    font-weight: 800;
    background: linear-gradient(135deg, #ffffff 0%, #ffe8d6 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.4rem;
}

.portal-ai-shell #loginStage:has(#userRegisterForm:not([hidden])) .stage-hint,
.portal-ai-shell #loginStage:has(#userRegisterForm:not([hidden])) .stage-header p {
    font-size: 0.82rem;
    font-weight: 500;
    color: rgba(255, 236, 214, 0.7);
}

.portal-ai-shell #userRegisterForm .input-group {
    margin-bottom: 0.65rem;
}

.portal-ai-shell .form-footer {
    color: rgba(255, 236, 214, 0.6);
}

.portal-ai-shell .feedback-msg {
    color: #ff8a3d;
    font-size: 0.8rem;
    font-weight: 600;
    margin-top: 0.5rem;
    text-align: center;
}

/* Modals in AI theme */
.portal-ai-shell .portal-modal-card {
    background: rgba(18, 10, 5, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(32px) saturate(145%);
    -webkit-backdrop-filter: blur(32px) saturate(145%);
    box-shadow: 0 42px 100px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border-radius: 20px;
}
.portal-ai-shell .portal-modal-title {
    color: #ffffff;
    font-weight: 800;
}
.portal-ai-shell .portal-modal-subtitle {
    color: rgba(255, 236, 214, 0.65);
}
.portal-ai-shell .portal-modal-close {
    color: rgba(255, 255, 255, 0.5);
    transition: all 0.2s ease;
}
.portal-ai-shell .portal-modal-close:hover {
    color: #ffffff;
}
.portal-ai-shell .btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 236, 214, 0.85);
    border-radius: 12px;
    padding: 0.75rem 1.25rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
}
.portal-ai-shell .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

.portal-ai-shell .portal-card.portal-stage-subjects {
    max-width: 400px;
    padding: 1.65rem 1.5rem 1.45rem;
}

.portal-ai-shell #subjectStage .stage-header-ref {
    justify-content: center;
    text-align: center;
    margin-bottom: 1.25rem;
}

.portal-ai-shell #subjectStage .stage-header-main {
    width: 100%;
    text-align: center;
}

.portal-ai-shell #subjectStage .stage-header-main h2 {
    font-family: var(--portal-font) !important;
    font-size: 1.65rem;
    font-weight: 800;
    line-height: 1.25;
    background: linear-gradient(135deg, #ffffff 0%, #ffe8d6 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0 0 0.42rem;
    letter-spacing: 0.03em;
    text-align: center;
    text-shadow: 0 2px 10px rgba(255, 122, 24, 0.15);
}

.portal-ai-shell #subjectStage .stage-hint {
    margin: 0;
    font-size: 0.82rem;
    font-weight: 500;
    line-height: 1.55;
    color: rgba(255, 236, 214, 0.7);
    letter-spacing: 0.02em;
}

.portal-ai-shell .subject-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
}

.portal-ai-shell .subject-card,
.portal-ai-shell .subject-card-wide {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 84px;
    padding: 0.55rem 0.3rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #ffffff;
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.portal-ai-shell .subject-card:hover:not(.disabled),
.portal-ai-shell .subject-card-wide:hover:not(.disabled) {
    transform: translateY(-3px) scale(1.02);
    background: rgba(255, 122, 24, 0.12);
    border-color: rgba(255, 122, 24, 0.4);
    box-shadow: 0 12px 30px rgba(255, 122, 24, 0.2);
}

.portal-ai-shell .subject-card.card-highlight {
    background: linear-gradient(135deg, rgba(255, 122, 24, 0.18) 0%, rgba(240, 103, 0, 0.1) 100%);
    border: 1.5px solid #ff7a18;
    box-shadow: 0 0 20px rgba(255, 122, 24, 0.25);
}

.portal-ai-shell .subject-card .card-icon,
.portal-ai-shell .subject-card-wide .card-icon {
    width: 1.85rem;
    height: 1.85rem;
    margin-bottom: 0.35rem;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #ff9d42;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
}

.portal-ai-shell .subject-card.card-highlight .card-icon {
    border-color: #ff7a18;
    color: #ffffff;
    background: rgba(255, 122, 24, 0.25);
}

.portal-ai-shell .subject-card .card-info,
.portal-ai-shell .subject-card-wide .card-info {
    align-items: center;
    width: 100%;
}

.portal-ai-shell .subject-card .card-title,
.portal-ai-shell .subject-card-wide .card-title {
    font-size: 0.82rem;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 0.15rem;
    transition: all 0.25s ease;
}

.portal-ai-shell .subject-card:hover:not(.disabled) .card-title {
    color: #ff9d42;
    text-shadow: 0 0 15px rgba(255, 122, 24, 0.4);
}

.portal-ai-shell .subject-card.card-highlight .card-title {
    color: #ff9d42;
}

.portal-ai-shell .subject-card .card-desc {
    font-size: 0.6rem;
    line-height: 1.35;
    color: rgba(255, 236, 214, 0.5);
    transition: all 0.25s ease;
}

.portal-ai-shell .subject-card:hover:not(.disabled) .card-desc {
    color: rgba(255, 236, 214, 0.85);
}

.portal-ai-shell .subject-card.card-highlight .card-desc {
    color: rgba(255, 236, 214, 0.7);
}

.portal-ai-shell .subject-card .card-meta {
    font-size: 0.6rem;
    color: rgba(255, 236, 214, 0.48);
}

.portal-ai-shell .subject-card .card-arrow,
.portal-ai-shell .subject-card .card-membership {
    display: none;
}

.portal-ai-shell .picker-divider {
    height: 1px;
    width: 100%;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 122, 24, 0.3) 50%, transparent 100%);
    margin: 0.65rem 0 1.05rem 0;
}

.portal-ai-shell .portal-card .ai-tools-section {
    display: block;
    margin-top: 0.95rem;
    border-top: 1px dashed rgba(36, 24, 12, 0.12);
    padding-top: 0.85rem;
}

.portal-ai-shell .ai-tools-title {
    margin: 0 0 0.6rem;
    font-size: 0.85rem;
    font-weight: 800;
    color: rgba(36, 24, 12, 0.72);
}

.portal-ai-shell .ai-tools-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.45rem;
}

.portal-ai-shell .ai-tool-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0.45rem 0.2rem;
    background: rgba(255, 255, 255, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.65);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.portal-ai-shell .ai-tool-item strong {
    font-size: 0.7rem;
    font-weight: 800;
    color: #1f1408;
    margin-bottom: 0.05rem;
}

.portal-ai-shell .ai-tool-item span {
    font-size: 0.58rem;
    color: rgba(36, 24, 12, 0.48);
    line-height: 1.25;
}

.portal-ai-shell .stage-actions {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.portal-ai-shell .btn-enter-ai {
    width: 100%;
    padding: 0.72rem 1.25rem;
    font-size: 0.95rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 999px;
    background: linear-gradient(180deg, #ff8c26 0%, #f06700 100%);
    color: #fff;
    border: none;
    box-shadow: 0 6px 16px rgba(240, 103, 0, 0.22);
    cursor: pointer;
    transition: all 0.25s ease;
    margin-bottom: 0.65rem;
}

.portal-ai-shell .btn-enter-ai:hover {
    filter: brightness(1.05);
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(240, 103, 0, 0.32);
}

.portal-ai-shell .btn-enter-ai svg {
    width: 1.2rem;
    height: 1.2rem;
    padding: 0.15rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
    flex-shrink: 0;
    transition: transform 0.25s ease;
}

.portal-ai-shell .btn-enter-ai:hover svg {
    transform: translateX(2px);
}

.portal-ai-shell .portal-bottom-shell {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: 0;
    width: min(1200px, 92vw);
    margin-top: 0;
    flex-shrink: 0;
    z-index: 4;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.portal-ai-shell .portal-bottom-bar {
    display: flex;
    flex-direction: column;
    width: 100%;
    margin-top: 0;
    margin-bottom: clamp(2.2rem, 5vh, 3.2rem);
    padding:
        clamp(0.9rem, 2vh, 1.25rem)
        clamp(1.5rem, 3vw, 2.5rem);
    border-radius: 28px;
    background: rgba(18, 10, 5, 0.35);
    border: 1px solid rgba(255, 247, 240, 0.08);
    box-shadow: 
        0 24px 48px -12px rgba(0, 0, 0, 0.72),
        inset 0 1px 1px rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.portal-ai-shell .portal-bottom-bar:hover {
    border-color: rgba(240, 103, 0, 0.24);
    box-shadow: 
        0 32px 64px -16px rgba(240, 103, 0, 0.12),
        0 24px 48px -12px rgba(0, 0, 0, 0.75),
        inset 0 1px 1px rgba(255, 255, 255, 0.15);
}

.portal-ai-shell .portal-bottom-dark {
    display: none !important;
}

.portal-ai-shell .portal-bottom-cta {
    display: none !important;
}

.portal-ai-shell .bottom-feature-list {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: clamp(0.75rem, 2vw, 1.5rem);
}

.portal-ai-shell .bottom-feature {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.85rem;
    flex: 1 1 0;
    min-width: 0;
    padding: 0.5rem 0.75rem;
    border-radius: 16px;
    background: transparent;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.portal-ai-shell .bottom-feature:hover {
    background: rgba(255, 255, 255, 0.03);
    transform: translateY(-2px);
}

.portal-ai-shell .bottom-feature-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(240, 103, 0, 0.18) 0%, rgba(240, 103, 0, 0.03) 100%);
    border: 1px solid rgba(240, 103, 0, 0.25);
    color: #ff9843;
    flex-shrink: 0;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 4px 12px rgba(240, 103, 0, 0.1);
}

.portal-ai-shell .bottom-feature:hover .bottom-feature-icon {
    background: linear-gradient(135deg, rgba(240, 103, 0, 0.32) 0%, rgba(240, 103, 0, 0.08) 100%);
    border-color: rgba(240, 103, 0, 0.45);
    color: #ffb875;
    box-shadow: 0 8px 20px rgba(240, 103, 0, 0.25);
    transform: scale(1.05);
}

.portal-ai-shell .bottom-feature-icon svg {
    width: 1.35rem;
    height: 1.35rem;
    filter: drop-shadow(0 2px 4px rgba(240, 103, 0, 0.3));
}

.portal-ai-shell .bottom-feature-copy {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.portal-ai-shell .bottom-feature-copy strong {
    font-size: clamp(0.92rem, 1.05vw, 1.08rem); /* Enlarged for better readability */
    font-weight: 700;
    line-height: 1.35;
    color: rgba(255, 255, 255, 0.95);
    letter-spacing: 0.01em;
    transition: color 0.3s ease;
}

.portal-ai-shell .bottom-feature:hover .bottom-feature-copy strong {
    color: #ffb875;
}

.portal-ai-shell .bottom-feature-copy span {
    font-size: clamp(0.72rem, 0.8vw, 0.82rem); /* Enlarged sub-description */
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.48);
    white-space: nowrap;
}

.portal-ai-shell .bottom-dock-copy {
    position: absolute;
    bottom: -2rem;
    left: 50%;
    transform: translateX(-50%);
    margin: 0;
    padding: 0;
    font-size: 0.66rem;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.38);
    text-align: center;
    white-space: nowrap;
}

.portal-ai-shell .app-footer {
    display: none !important;
}

.portal-ai-shell .main-desc {
    display: block !important;
}

@media (max-width: 1100px) {
    .portal-ai-shell .brand-content {
        transform: none;
    }

    .portal-ai-shell .portal-bottom-bar {
        padding-right: clamp(1rem, 3vw, 2rem);
        border-radius: 22px;
    }

    .portal-ai-shell .bottom-feature-list {
        flex-wrap: wrap;
        row-gap: 0.85rem;
    }

    .portal-ai-shell .bottom-feature {
        flex: 1 1 calc(50% - 0.75rem);
        min-width: 9rem;
    }
}

@media (max-width: 900px) {
    .portal-ai-shell .portal-bottom-cta {
        position: static;
        width: auto;
        margin: 0 clamp(1rem, 3vw, 2rem) 0.85rem;
        order: 2;
    }

    .portal-ai-shell .portal-bottom-dark {
        order: 3;
    }

    .portal-ai-shell .portal-bottom-shell {
        position: relative !important;
        left: 0 !important;
        bottom: 0 !important;
        transform: none !important;
        width: 100% !important;
        margin-top: 2rem !important;
        display: flex;
        flex-direction: column;
        align-items: center !important;
    }

    .portal-ai-shell .portal-bottom-bar {
        width: 100% !important;
        max-width: none !important;
        border-radius: 20px 20px 0 0 !important;
        background: rgba(18, 10, 5, 0.45) !important;
        border: 1px solid rgba(255, 247, 240, 0.08) !important;
        border-bottom: none !important;
        padding: 1.25rem 1.5rem !important;
        margin-bottom: 0 !important;
    }

    .portal-ai-shell .bottom-dock-copy {
        position: static !important;
        transform: none !important;
        margin: 0.75rem 0 0 !important;
        text-align: center !important;
        color: rgba(255, 255, 255, 0.38) !important;
    }

    .portal-ai-shell .view-grid {
        grid-template-columns: 1fr;
    }

    .portal-ai-shell .branding-panel {
        text-align: center;
    }

    .portal-ai-shell .title-head,
    .portal-ai-shell .brand-tag,
    .portal-ai-shell .main-desc,
    .portal-ai-shell .brand-highlights,
    .portal-ai-shell .feature-pills {
        margin-left: auto;
        margin-right: auto;
    }

    .portal-ai-shell .main-title {
        margin-left: auto;
        margin-right: auto;
    }

    .portal-ai-shell .title-top-row {
        display: inline-block;
        padding-top: 0.52rem;
        padding-right: clamp(7.8rem, 25vw, 10rem);
    }

    .portal-ai-shell .title-line-brand {
        font-size: clamp(1.75rem, 5.5vw, 2.35rem);
    }

    .portal-ai-shell .title-line-accent {
        text-align: center;
        font-size: clamp(2.6rem, 10vw, 3.6rem);
    }

    .portal-ai-shell .brand-tag {
        position: absolute;
        top: 0;
        right: 0;
        transform: translate(10%, -10%);
        font-size: clamp(0.68rem, 2.6vw, 0.78rem);
        padding: 0.24rem 0.62rem;
    }

    .portal-ai-shell .brand-highlights {
        justify-content: center;
    }

    .portal-ai-shell .feature-pills {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: min(100%, 440px);
    }

    .portal-ai-shell .bg-photo {
        object-position: 52% 50% !important;
        transform: none !important;
    }

    .portal-ai-shell .video-overlay {
        background:
            linear-gradient(
                180deg,
                rgba(8, 4, 2, 0.52) 0%,
                rgba(8, 4, 2, 0.18) 42%,
                rgba(8, 4, 2, 0.48) 100%
            ),
            linear-gradient(
                90deg,
                rgba(8, 4, 2, 0.42) 0%,
                rgba(8, 4, 2, 0.12) 55%,
                rgba(8, 4, 2, 0.28) 100%
            );
    }
}

@media (max-width: 600px) {
    .portal-ai-shell .bg-photo {
        object-position: 50% 46% !important;
    }

    .portal-ai-shell .portal-card {
        padding: 1.35rem 1.1rem 1.15rem;
        border-radius: 20px;
    }

    .portal-ai-shell .feature-pills {
        grid-template-columns: 1fr 1fr;
        gap: 0.55rem;
    }

    .portal-ai-shell .feature-pills .stat-item {
        padding: 0.65rem 0.72rem;
    }

    .portal-ai-shell .portal-bottom-bar {
        padding: 1rem 1rem 0.85rem;
    }

    .portal-ai-shell .portal-bottom-cta {
        margin: 0 1rem 0.75rem;
        width: auto;
    }

    .portal-ai-shell .bottom-feature-list {
        flex-direction: column;
        gap: 0.75rem;
    }

    .portal-ai-shell .bottom-feature {
        flex: 1 1 auto;
        min-width: 0;
    }

    .portal-ai-shell .brand-highlights {
        flex-direction: column;
        align-items: center;
        gap: 0.65rem;
    }

    .portal-ai-shell .stage-header-ref {
        flex-direction: column;
    }
}
/* Background Media & Overlays for AI Theme */
.portal-ai-shell .bg-video {
    display: none !important;
}

.portal-ai-shell .bg-photo-wrap {
    display: block !important;
    z-index: 1;
}

.portal-ai-shell .video-overlay {
    z-index: 2;
    background: radial-gradient(circle at center, rgba(18, 10, 5, 0) 0%, rgba(18, 10, 5, 0.12) 100%);
    pointer-events: none;
}

.portal-ai-shell .ambient-glow {
    z-index: 3;
    pointer-events: none;
}

/* Hard fix for registration form input alignments, paddings and sizes to match login inputs exactly */
.portal-ai-shell .portal-wrapper:has(#userRegisterForm:not([hidden])) #userRegisterForm .input-group.input-plain input,
.portal-ai-shell #userRegisterForm .input-group.input-plain input {
    padding: 0.92rem 1.05rem !important;
    font-size: 0.9rem !important;
    font-weight: 500 !important;
    height: auto !important;
    min-height: unset !important;
}

@media (max-width: 1100px) {
    .portal-ai-shell .brand-content {
        transform: none;
    }

    .portal-ai-shell .portal-wrapper:has(#userRegisterForm:not([hidden])) #userRegisterForm .input-group.input-plain input,
    .portal-ai-shell #userRegisterForm .input-group.input-plain input {
        padding: 0.84rem 0.98rem !important;
        font-size: 0.85rem !important;
    }
}

@media (max-width: 600px) {
    .portal-ai-shell .portal-wrapper:has(#userRegisterForm:not([hidden])) #userRegisterForm .input-group.input-plain input,
    .portal-ai-shell #userRegisterForm .input-group.input-plain input {
        padding: 0.8rem 0.92rem !important;
        font-size: 0.82rem !important;
    }
}

@media (max-width: 420px), (max-width: 600px) and (max-height: 740px) {
    .portal-ai-shell .portal-wrapper:has(#userRegisterForm:not([hidden])) #userRegisterForm .input-group.input-plain input,
    .portal-ai-shell #userRegisterForm .input-group.input-plain input {
        padding: 0.72rem 0.85rem !important;
        font-size: 0.78rem !important;
    }
}

/* Device-responsive polish for desktop, tablet and phone */
@media (min-width: 901px) and (max-width: 1180px) {
    .portal-ai-shell .portal-wrapper {
        max-width: none;
        padding: 4.9rem clamp(1.4rem, 3vw, 2.25rem) 1rem !important;
    }

    .portal-ai-shell .portal-topbrand {
        top: 1rem;
        left: 1.25rem;
        transform: scale(0.88);
        transform-origin: top left;
    }

    .portal-ai-shell .portal-content {
        align-items: center;
        padding-top: 0;
        padding-bottom: 5.8rem;
    }

    .portal-ai-shell .view-grid {
        grid-template-columns: minmax(0, 0.98fr) minmax(320px, 38vw);
        gap: clamp(1.15rem, 2.6vw, 2rem);
        transform: none;
    }

    .portal-ai-shell .brand-content {
        width: min(100%, 30rem);
        transform: none;
    }

    .portal-ai-shell .title-head {
        margin-bottom: 0.55rem;
    }

    .portal-ai-shell .title-top-row {
        gap: 0.32rem;
    }

    .portal-ai-shell .title-line-brand {
        font-size: clamp(1.95rem, 3.6vw, 2.72rem);
    }

    .portal-ai-shell .brand-tag {
        padding: 0.42rem 0.92rem;
        font-size: clamp(0.78rem, 1.35vw, 1rem);
    }

    .portal-ai-shell .brand-tag-x {
        margin: 0 0.35em;
    }

    .portal-ai-shell .title-line-accent {
        font-size: clamp(3rem, 6vw, 4.65rem);
    }

    .portal-ai-shell .main-desc {
        margin-bottom: 0.62rem;
        font-size: 0.88rem;
        line-height: 1.55;
    }

    .portal-ai-shell .brand-divider {
        margin-bottom: 0.78rem;
    }

    .portal-ai-shell .brand-highlights {
        gap: 0.55rem 1rem;
        margin-bottom: 0.88rem;
    }

    .portal-ai-shell .brand-highlights li {
        font-size: 0.74rem;
    }

    .portal-ai-shell .feature-pills {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: min(100%, 360px);
        gap: 0.48rem;
    }

    .portal-ai-shell .feature-pills .stat-item {
        padding: 0.56rem 0.64rem;
    }

    .portal-ai-shell .feature-pills .stat-value {
        font-size: 0.86rem;
    }

    .portal-ai-shell .feature-pills .stat-label {
        font-size: 0.62rem;
    }

    .portal-ai-shell .portal-card {
        max-width: 360px;
        padding: 1.3rem 1.2rem 1.16rem;
        border-radius: 21px;
    }

    .portal-ai-shell #loginStage .stage-header {
        margin-bottom: 0.95rem;
    }

    .portal-ai-shell #loginStage .stage-header-main h2,
    .portal-ai-shell #loginStage .stage-header h2 {
        font-size: 1.48rem;
    }

    .portal-ai-shell .auth-tabs {
        margin-bottom: 0.88rem;
    }

    .portal-ai-shell #loginStage .input-group {
        margin-bottom: 0.7rem;
    }

    .portal-ai-shell .input-group.input-plain input,
    .portal-ai-shell #loginStage .input-group.input-plain input,
    .portal-ai-shell #userRegisterForm .input-group.input-plain input {
        padding: 0.78rem 0.9rem;
        font-size: 0.84rem;
    }

    .portal-ai-shell .btn-primary,
    .portal-ai-shell #loginStage .btn-primary,
    .portal-ai-shell #userRegisterForm .btn-primary {
        padding: 0.82rem 1rem;
        font-size: 0.9rem;
    }

    .portal-ai-shell .portal-bottom-shell {
        width: min(920px, 92vw);
    }

    .portal-ai-shell .portal-bottom-bar {
        margin-bottom: 1rem;
        padding: 0.72rem 0.95rem;
        border-radius: 18px;
    }

    .portal-ai-shell .bottom-feature {
        gap: 0.55rem;
        padding: 0.38rem 0.48rem;
    }

    .portal-ai-shell .bottom-feature-icon {
        width: 2.1rem;
        height: 2.1rem;
        border-radius: 10px;
    }

    .portal-ai-shell .bottom-feature-icon svg {
        width: 1.05rem;
        height: 1.05rem;
    }

    .portal-ai-shell .bottom-feature-copy strong {
        font-size: 0.8rem;
    }

    .portal-ai-shell .bottom-feature-copy span {
        display: none;
    }
}

@media (min-width: 901px) and (max-width: 1180px) and (max-height: 820px) {
    html,
    body.portal-ai-shell {
        height: auto !important;
        min-height: 100svh;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    .portal-ai-shell .portal-wrapper {
        height: auto !important;
        min-height: 100svh;
        padding-bottom: 0.8rem !important;
    }

    .portal-ai-shell .portal-content {
        padding-bottom: 0.1rem;
    }

    .portal-ai-shell .portal-bottom-shell {
        display: none !important;
    }
}

@media (min-width: 901px) and (max-height: 760px) {
    .portal-ai-shell .portal-wrapper {
        padding-top: 4rem !important;
        padding-bottom: 0.8rem !important;
    }

    .portal-ai-shell .portal-content {
        padding-bottom: 0;
    }

    .portal-ai-shell .view-grid {
        transform: none;
    }

    .portal-ai-shell .brand-content {
        transform: translateX(24px);
    }

    .portal-ai-shell .main-desc,
    .portal-ai-shell .brand-divider,
    .portal-ai-shell .feature-pills,
    .portal-ai-shell .portal-bottom-shell {
        display: none !important;
    }

    .portal-ai-shell .brand-highlights {
        margin-bottom: 0;
    }

    .portal-ai-shell .portal-card {
        max-height: calc(100svh - 5.2rem);
        overflow-y: auto;
    }
}

@media (max-width: 900px) {
    html,
    body.portal-ai-shell {
        height: auto !important;
        min-height: 100svh;
        overflow-x: hidden !important;
        overflow-y: auto !important;
    }

    .portal-ai-shell .portal-wrapper {
        height: auto !important;
        min-height: 100svh;
        max-width: none;
        padding: 5.2rem clamp(0.95rem, 4vw, 1.6rem) 1.2rem !important;
    }

    .portal-ai-shell .portal-topbrand {
        top: 0.9rem;
        left: 0.95rem;
        transform: scale(0.86);
        transform-origin: top left;
    }

    .portal-ai-shell .portal-content {
        display: block;
        flex: 0 0 auto;
        padding: 0;
    }

    .portal-ai-shell .view-grid {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: clamp(0.85rem, 2.5vh, 1.35rem) !important;
        align-items: start;
        width: 100%;
        transform: none !important;
    }

    .portal-ai-shell .branding-panel,
    .portal-ai-shell .action-panel {
        width: 100%;
        justify-content: center;
        text-align: center;
    }

    .portal-ai-shell .brand-content {
        width: min(100%, 28rem);
        margin: 0 auto;
        transform: none !important;
    }

    .portal-ai-shell .title-head {
        margin-bottom: 0.35rem;
    }

    .portal-ai-shell .main-title {
        margin-left: auto;
        margin-right: auto;
    }

    .portal-ai-shell .title-top-row {
        display: inline-flex;
        justify-content: center;
        gap: 0.3rem;
        padding-top: 0;
        padding-right: 0;
    }

    .portal-ai-shell .title-line-brand {
        font-size: clamp(1.7rem, 7vw, 2.45rem);
    }

    .portal-ai-shell .brand-tag {
        position: static;
        transform: none;
        max-width: 48vw;
        padding: 0.28rem 0.58rem;
        font-size: clamp(0.66rem, 2.55vw, 0.82rem);
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .portal-ai-shell .title-brand-tag {
        display: inline-flex;
        margin: 0 auto 0.35rem;
        max-width: 100%;
    }

    .portal-ai-shell .brand-tag-x {
        margin: 0 0.28em;
    }

    .portal-ai-shell .title-line-accent {
        font-size: clamp(2.55rem, 12vw, 4rem);
        text-align: center;
    }

    .portal-ai-shell .main-desc,
    .portal-ai-shell .brand-divider,
    .portal-ai-shell .brand-highlights,
    .portal-ai-shell .feature-pills,
    .portal-ai-shell .portal-bottom-shell {
        display: none !important;
    }

    .portal-ai-shell .portal-card {
        width: min(100%, 25rem);
        max-width: none;
        max-height: none;
        margin: 0 auto;
        padding: 1.18rem 1rem 1rem;
        border-radius: 20px;
    }

    .portal-ai-shell #loginStage .stage-header {
        margin-bottom: 0.82rem;
    }

    .portal-ai-shell #loginStage .stage-header-main h2,
    .portal-ai-shell #loginStage .stage-header h2 {
        font-size: clamp(1.28rem, 5vw, 1.55rem);
        margin-bottom: 0.28rem;
    }

    .portal-ai-shell #loginStage .stage-hint,
    .portal-ai-shell #loginStage .stage-header p {
        font-size: 0.76rem;
    }

    .portal-ai-shell .auth-tabs {
        margin-bottom: 0.75rem;
        border-radius: 12px;
    }

    .portal-ai-shell .auth-tab {
        padding: 0.52rem 0.45rem;
        font-size: 0.8rem;
        border-radius: 9px;
    }

    .portal-ai-shell #loginStage .input-group {
        margin-bottom: 0.62rem;
    }

    .portal-ai-shell .input-group.input-plain input,
    .portal-ai-shell #loginStage .input-group.input-plain input,
    .portal-ai-shell #userRegisterForm .input-group.input-plain input {
        padding: 0.75rem 0.86rem !important;
        font-size: 0.82rem !important;
        border-radius: 10px;
    }

    .portal-ai-shell #loginStage .form-utils {
        margin-bottom: 0.78rem;
    }

    .portal-ai-shell .btn-primary,
    .portal-ai-shell #loginStage .btn-primary,
    .portal-ai-shell #userRegisterForm .btn-primary {
        margin-top: 0.55rem;
        padding: 0.78rem 0.9rem;
        font-size: 0.86rem;
        border-radius: 12px;
    }

    .portal-ai-shell #loginStage .form-footer,
    .portal-ai-shell #userRegisterForm .form-footer {
        margin-top: 0.72rem;
        font-size: 0.74rem;
    }
}

@media (max-width: 600px) {
    .portal-ai-shell .bg-photo {
        object-position: 58% 50% !important;
    }

    .portal-ai-shell .portal-wrapper {
        padding: 4.7rem 0.82rem 1rem !important;
    }

    .portal-ai-shell .portal-topbrand {
        top: 0.72rem;
        left: 0.72rem;
        grid-template-columns: 42px auto;
        grid-template-rows: 27px 16px;
        column-gap: 9px;
        row-gap: 1px;
        width: max-content;
        max-width: calc(100vw - 1.45rem);
        transform: none;
    }

    .portal-ai-shell .portal-topbrand-mark,
    .portal-ai-shell .yuanfudao-logo-icon {
        width: 42px;
        height: 42px;
    }

    .portal-ai-shell .portal-topbrand-copy strong {
        font-size: clamp(18px, 5.6vw, 22px);
        line-height: 27px;
    }

    .portal-ai-shell .portal-topbrand-copy span {
        font-size: clamp(7px, 2.35vw, 9px);
        line-height: 13px;
        letter-spacing: 0.04em;
    }

    .portal-ai-shell .brand-content {
        width: min(100%, 23rem);
    }

    .portal-ai-shell .title-line-brand {
        font-size: clamp(1.45rem, 8.2vw, 2rem);
    }

    .portal-ai-shell .title-line-accent {
        font-size: clamp(2.28rem, 14vw, 3.25rem);
        letter-spacing: 0.01em;
    }

    .portal-ai-shell .brand-tag {
        padding: 0.22rem 0.46rem;
        font-size: clamp(0.58rem, 2.6vw, 0.72rem);
    }

    .portal-ai-shell .portal-card {
        width: min(100%, 22.5rem);
        padding: 1rem 0.88rem 0.88rem;
        border-radius: 18px;
    }
}

@media (max-width: 430px) {
    .portal-ai-shell .brand-tag {
        display: none;
    }

    .portal-ai-shell .title-brand-tag {
        display: none;
    }

    .portal-ai-shell .title-top-row {
        display: block;
    }

    .portal-ai-shell .title-line-brand {
        display: block;
        font-size: clamp(1.5rem, 10vw, 1.9rem);
        text-align: center;
    }

    .portal-ai-shell .title-line-accent {
        font-size: clamp(2.15rem, 15vw, 2.85rem);
    }
}

@media (max-width: 600px) and (max-height: 740px) {
    .portal-ai-shell .portal-wrapper {
        padding-top: 3.75rem !important;
    }

    .portal-ai-shell .portal-topbrand-copy span,
    .portal-ai-shell #loginStage .stage-hint,
    .portal-ai-shell #loginStage .stage-header p {
        display: none !important;
    }

    .portal-ai-shell .portal-topbrand {
        grid-template-rows: 34px;
        width: max-content;
        max-width: calc(100vw - 1.5rem);
    }

    .portal-ai-shell .portal-topbrand-mark,
    .portal-ai-shell .yuanfudao-logo-icon {
        width: 36px;
        height: 36px;
    }

    .portal-ai-shell .portal-topbrand-copy strong {
        align-self: center;
        font-size: clamp(15px, 4.4vw, 19px);
        line-height: 24px;
    }

    .portal-ai-shell .title-line-brand {
        font-size: clamp(1.25rem, 8.5vw, 1.55rem);
    }

    .portal-ai-shell .title-line-accent {
        font-size: clamp(1.95rem, 13vw, 2.45rem);
    }

    .portal-ai-shell .title-head {
        margin-bottom: 0.18rem;
    }

    .portal-ai-shell .portal-card {
        padding: 0.82rem 0.76rem 0.76rem;
    }

    .portal-ai-shell #loginStage .stage-header {
        margin-bottom: 0.58rem;
    }

    .portal-ai-shell .auth-tabs {
        margin-bottom: 0.55rem;
    }

    .portal-ai-shell #loginStage .input-group {
        margin-bottom: 0.5rem;
    }

    .portal-ai-shell #loginStage .form-utils {
        margin-bottom: 0.5rem;
    }
}

/* Final responsive alignment pass: keep the title centered on the login card axis. */
@media (max-width: 900px) {
    .portal-ai-shell .brand-content,
    .portal-ai-shell .portal-card {
        width: min(100%, 25rem) !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    .portal-ai-shell .title-head,
    .portal-ai-shell h1.main-title {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: auto !important;
        margin-right: auto !important;
        text-align: center !important;
    }

    .portal-ai-shell .title-top-row {
        width: 100% !important;
        justify-content: center !important;
        text-align: center !important;
    }

    .portal-ai-shell .title-line-brand,
    .portal-ai-shell .title-line-accent {
        transform-origin: center center !important;
    }

    .portal-ai-shell .title-line-accent {
        width: 100% !important;
        text-align: center !important;
    }
}

@media (max-width: 600px) {
    .portal-ai-shell .portal-topbrand {
        top: max(0.68rem, env(safe-area-inset-top)) !important;
        left: max(0.68rem, env(safe-area-inset-left)) !important;
        grid-template-columns: 40px auto !important;
        grid-template-rows: 26px 15px !important;
        column-gap: 8px !important;
        width: max-content !important;
        max-width: calc(100vw - 1.36rem) !important;
        transform: none !important;
    }

    .portal-ai-shell .portal-topbrand-mark,
    .portal-ai-shell .yuanfudao-logo-icon {
        width: 40px !important;
        height: 40px !important;
    }

    .portal-ai-shell .portal-topbrand-copy strong {
        font-size: clamp(17px, 5.4vw, 21px) !important;
        line-height: 26px !important;
    }

    .portal-ai-shell .portal-topbrand-copy span {
        font-size: clamp(7px, 2.25vw, 9px) !important;
        line-height: 13px !important;
        letter-spacing: 0.03em !important;
    }

    .portal-ai-shell .brand-content,
    .portal-ai-shell .portal-card {
        width: min(100%, 22.5rem) !important;
    }
}

@media (max-width: 430px) {
    .portal-ai-shell .portal-topbrand {
        grid-template-columns: 36px auto !important;
        grid-template-rows: 24px 14px !important;
        column-gap: 7px !important;
        width: 168px !important;
    }

    .portal-ai-shell .portal-topbrand-mark,
    .portal-ai-shell .yuanfudao-logo-icon {
        width: 36px !important;
        height: 36px !important;
    }

    .portal-ai-shell .portal-topbrand-copy strong {
        font-size: 21px !important;
        line-height: 24px !important;
    }

    .portal-ai-shell .portal-topbrand-copy span {
        font-size: 8px !important;
        line-height: 12px !important;
    }

    .portal-ai-shell .title-top-row {
        display: block !important;
    }

    .portal-ai-shell .title-line-brand {
        display: block !important;
        width: 100% !important;
        text-align: center !important;
    }
}

@media (max-width: 600px) and (max-height: 740px) {
    .portal-ai-shell .portal-topbrand {
        grid-template-columns: 34px auto !important;
        grid-template-rows: 32px !important;
        width: 158px !important;
    }

    .portal-ai-shell .portal-topbrand-mark,
    .portal-ai-shell .yuanfudao-logo-icon {
        width: 34px !important;
        height: 34px !important;
    }

    .portal-ai-shell .portal-topbrand-copy strong {
        font-size: 20px !important;
        line-height: 23px !important;
    }
}

/* Portrait devices: center the title/login cluster in the viewport. */
@media (max-width: 900px) and (orientation: portrait) {
    html,
    body.portal-ai-shell {
        height: 100% !important;
        min-height: 100svh;
        overflow-x: hidden !important;
        overflow-y: auto !important;
    }

    .portal-ai-shell .portal-wrapper {
        height: 100svh !important;
        min-height: 100svh !important;
        padding: 0.8rem clamp(0.95rem, 4vw, 1.6rem) !important;
    }

    .portal-ai-shell .portal-content {
        min-height: 100%;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 0 !important;
    }

    .portal-ai-shell .view-grid {
        width: 100%;
        height: auto !important;
        min-height: 0 !important;
        grid-template-rows: auto auto !important;
        align-content: center !important;
        align-items: center !important;
        justify-items: center !important;
        transform: none !important;
    }

    .portal-ai-shell .branding-panel,
    .portal-ai-shell .action-panel {
        width: 100%;
        display: flex;
        justify-content: center;
    }

    .portal-ai-shell .brand-tag {
        display: none !important;
    }

    .portal-ai-shell .title-top-row {
        display: flex !important;
        width: 100% !important;
        justify-content: center !important;
    }

    .portal-ai-shell .title-line-brand {
        display: block !important;
        width: 100% !important;
        text-align: center !important;
    }
}

@media (min-width: 601px) and (max-width: 900px) and (orientation: portrait) {
    .portal-ai-shell .view-grid {
        gap: clamp(1rem, 2.4vh, 1.65rem) !important;
        transform: translateY(clamp(0.8rem, 2.1vh, 1.45rem)) !important;
    }
}

@media (max-width: 600px) and (orientation: portrait) {
    .portal-ai-shell .portal-wrapper {
        padding: 0.72rem 0.82rem !important;
    }

    .portal-ai-shell .view-grid {
        gap: clamp(0.78rem, 2.1vh, 1.15rem) !important;
        transform: translateY(clamp(0.55rem, 2vh, 1.1rem)) !important;
    }
}

@media (max-width: 600px) and (max-height: 740px) and (orientation: portrait) {
    .portal-ai-shell .portal-wrapper {
        padding: 0.55rem 0.76rem !important;
    }

    .portal-ai-shell .view-grid {
        gap: 0.55rem !important;
        transform: translateY(clamp(0.28rem, 1.05vh, 0.65rem)) !important;
    }
}

/* Large desktop / 4K landscape: scale the interface back up and tighten composition. */
@media (min-width: 1900px) and (min-height: 1000px) and (orientation: landscape) {
    html,
    body.portal-ai-shell {
        overflow: hidden !important;
    }

    .portal-ai-shell .portal-wrapper {
        max-width: 1920px;
        height: 100vh;
        min-height: 100vh;
        padding:
            clamp(2rem, 3vh, 3.2rem)
            clamp(3rem, 4.5vw, 5rem)
            0 !important;
    }

    .portal-ai-shell .portal-topbrand {
        top: clamp(2.1rem, 3vh, 3rem);
        left: clamp(3rem, 4.2vw, 5rem);
        grid-template-columns: 62px auto;
        grid-template-rows: 43px 23px;
        column-gap: 16px;
        row-gap: 4px;
        width: 292px;
        transform: none;
    }

    .portal-ai-shell .portal-topbrand-mark,
    .portal-ai-shell .yuanfudao-logo-icon {
        width: 62px;
        height: 62px;
    }

    .portal-ai-shell .portal-topbrand-copy strong {
        font-size: 38px;
        line-height: 43px;
    }

    .portal-ai-shell .portal-topbrand-copy span {
        font-size: 14px;
        line-height: 20px;
        letter-spacing: 0.14em;
    }

    .portal-ai-shell .portal-content {
        align-items: center;
        padding-top: 0;
        padding-bottom: clamp(8rem, 11vh, 10.5rem);
    }

    .portal-ai-shell .view-grid {
        width: min(100%, 1700px);
        margin: 0 auto;
        grid-template-columns: minmax(0, 0.9fr) minmax(500px, 560px);
        gap: clamp(3rem, 4.2vw, 5.4rem);
        align-items: center;
        transform: translateY(-1.2vh);
    }

    .portal-ai-shell .brand-content {
        width: min(100%, 46rem);
        transform: none;
    }

    .portal-ai-shell .title-head {
        margin-bottom: 1.08rem;
    }

    .portal-ai-shell .title-top-row {
        gap: 0.58rem;
        margin-bottom: 0.2rem;
    }

    .portal-ai-shell .title-line-brand {
        font-size: clamp(3.35rem, 2.8vw, 4.7rem);
    }

    .portal-ai-shell .brand-tag {
        padding: 0.66rem 1.62rem;
        font-size: clamp(1.05rem, 0.86vw, 1.28rem);
    }

    .portal-ai-shell .brand-tag-x {
        margin: 0 0.42em;
    }

    .portal-ai-shell .title-line-accent {
        font-size: clamp(5.4rem, 4.6vw, 6.9rem);
    }

    .portal-ai-shell .main-desc {
        margin-bottom: 1.1rem;
        font-size: clamp(1rem, 0.84vw, 1.18rem);
        line-height: 1.72;
    }

    .portal-ai-shell .brand-divider {
        margin-bottom: 1.05rem;
    }

    .portal-ai-shell .brand-highlights {
        gap: 0.72rem 1.55rem;
        margin-bottom: 1.15rem;
    }

    .portal-ai-shell .brand-highlights li {
        font-size: 0.94rem;
    }

    .portal-ai-shell .feature-pills {
        width: min(100%, 540px);
        gap: 0.72rem;
    }

    .portal-ai-shell .feature-pills .stat-item {
        padding: 0.78rem 0.98rem;
    }

    .portal-ai-shell .feature-pills .stat-value {
        font-size: 1.02rem;
    }

    .portal-ai-shell .feature-pills .stat-label {
        font-size: 0.73rem;
    }

    .portal-ai-shell .portal-card {
        max-width: 520px;
        padding: 2.15rem 2rem 1.9rem;
        border-radius: 30px;
    }

    .portal-ai-shell #loginStage .stage-header {
        margin-bottom: 1.22rem;
    }

    .portal-ai-shell #loginStage .stage-header-main h2,
    .portal-ai-shell #loginStage .stage-header h2 {
        font-size: 2.12rem;
    }

    .portal-ai-shell #loginStage .stage-hint,
    .portal-ai-shell #loginStage .stage-header p {
        font-size: 0.94rem;
    }

    .portal-ai-shell .auth-tabs {
        margin-bottom: 1.1rem;
        padding: 0.34rem;
        border-radius: 18px;
    }

    .portal-ai-shell .auth-tab {
        padding: 0.78rem 0.7rem;
        font-size: 1rem;
        border-radius: 13px;
    }

    .portal-ai-shell #loginStage .input-group {
        margin-bottom: 0.9rem;
    }

    .portal-ai-shell .input-group.input-plain input,
    .portal-ai-shell #loginStage .input-group.input-plain input,
    .portal-ai-shell #userRegisterForm .input-group.input-plain input {
        min-height: 58px;
        padding: 1rem 1.08rem !important;
        font-size: 1rem !important;
        border-radius: 15px;
    }

    .portal-ai-shell #loginStage .form-utils {
        margin-bottom: 1.02rem;
    }

    .portal-ai-shell .btn-primary,
    .portal-ai-shell #loginStage .btn-primary,
    .portal-ai-shell #userRegisterForm .btn-primary {
        padding: 1.02rem 1.15rem;
        font-size: 1.06rem;
        border-radius: 16px;
    }

    .portal-ai-shell #loginStage .form-footer,
    .portal-ai-shell #userRegisterForm .form-footer {
        margin-top: 1rem;
        font-size: 0.92rem;
    }

    .portal-ai-shell .portal-bottom-shell {
        width: min(1400px, 70vw);
        bottom: clamp(2rem, 4vh, 4rem);
    }

    .portal-ai-shell .portal-bottom-bar {
        margin-bottom: 0;
        padding: 1rem 2rem;
        border-radius: 24px;
    }

    .portal-ai-shell .bottom-feature {
        gap: 0.82rem;
        padding: 0.58rem 0.72rem;
    }

    .portal-ai-shell .bottom-feature-icon {
        width: 2.65rem;
        height: 2.65rem;
        border-radius: 13px;
    }

    .portal-ai-shell .bottom-feature-icon svg {
        width: 1.25rem;
        height: 1.25rem;
    }

    .portal-ai-shell .bottom-feature-copy strong {
        font-size: 0.96rem;
    }

    .portal-ai-shell .bottom-feature-copy span {
        font-size: 0.74rem;
    }
}

/* Final portrait title centering: keep the hero title on the same axis as the login card. */
@media (orientation: portrait) and (max-width: 1180px) {
    .portal-ai-shell .portal-content,
    .portal-ai-shell .view-grid,
    .portal-ai-shell .branding-panel,
    .portal-ai-shell .action-panel {
        justify-items: center !important;
        justify-content: center !important;
        text-align: center !important;
    }

    .portal-ai-shell .brand-content,
    .portal-ai-shell .portal-card {
        width: min(100%, clamp(22rem, 58vw, 25rem)) !important;
        margin-left: auto !important;
        margin-right: auto !important;
        transform: none !important;
    }

    .portal-ai-shell .title-head,
    .portal-ai-shell h1.main-title,
    .portal-ai-shell .title-brand-stack,
    .portal-ai-shell .title-line-brand,
    .portal-ai-shell .title-line-accent {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: auto !important;
        margin-right: auto !important;
        text-align: center !important;
    }

    .portal-ai-shell h1.main-title,
    .portal-ai-shell .title-brand-stack {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
    }

    .portal-ai-shell .title-line-brand,
    .portal-ai-shell .title-line-accent {
        display: block !important;
        transform-origin: center center !important;
    }
}

@media (orientation: portrait) and (max-width: 600px) {
    .portal-ai-shell .brand-content,
    .portal-ai-shell .portal-card {
        width: min(100%, clamp(19.5rem, 88vw, 22.5rem)) !important;
    }
}

@media (orientation: portrait) and (max-width: 430px) {
    .portal-ai-shell .brand-content,
    .portal-ai-shell .portal-card {
        width: min(100%, calc(100vw - 2rem)) !important;
    }
}
