/* 基础重置与全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    min-height: 100vh;
    padding: 20px;
}

/* ========== 容器系统 - 三层宽度策略 ========== */
/* Default: 默认容器（兼容旧代码） */
.container {
    max-width: var(--container-default);
    margin: 0 auto;
    background-color: white;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    min-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
}

/* Wide: 平台级页面（首页、列表页、工作区） */
.container.container--wide {
    max-width: var(--container-wide);
}

/* Medium: 详情页（模板详情、方案详情） */
.container.container--medium {
    max-width: var(--container-medium);
}

/* Narrow: 运行页（答题页、任务页、结果页） */
.container.container--narrow {
    max-width: var(--container-narrow);
}








/* 用户导航样式 */
.user-nav {
    position: relative;
    z-index: 2;
    pointer-events: none; /* 让点击穿透到子元素 */
}

.user-nav-content {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    pointer-events: auto; /* 子元素恢复点击 */
}

.user-status-light {
    font-size: 0.85rem;
    opacity: 0.9;
    text-align: right;
    line-height: 1.3;
    padding: 2px 0;
}

.user-nav-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    pointer-events: auto;
}

/* 登录后导航操作 */
.logged-nav-actions {
    display: none;
    gap: 8px;
    align-items: center;
}

.logged-nav-actions.show {
    display: flex !important;
}

.nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    pointer-events: auto;
    z-index: 3;
    position: relative;
}

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

.guest-nav-btn {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
}

.login-nav-btn {
    background: rgba(46, 204, 113, 0.2);
    border-color: rgba(46, 204, 113, 0.4);
}

.login-nav-btn:hover {
    background: rgba(46, 204, 113, 0.3);
}

.register-nav-btn {
    background: rgba(52, 152, 219, 0.2);
    border-color: rgba(52, 152, 219, 0.4);
}

.register-nav-btn:hover {
    background: rgba(52, 152, 219, 0.3);
}

.workspace-nav-btn {
    background: rgba(52, 152, 219, 0.25);
    border-color: rgba(52, 152, 219, 0.5);
}

.profile-nav-btn {
    background: rgba(155, 89, 182, 0.25);
    border-color: rgba(155, 89, 182, 0.5);
}

.logout-nav-btn {
    background: rgba(231, 76, 60, 0.15);
    border-color: rgba(231, 76, 60, 0.4);
}

.logout-nav-btn:hover {
    background: rgba(231, 76, 60, 0.25);
}





/* 主内容区域 */
.main-content {
    flex: 1;
    padding: 40px 30px;
}

.platform-intro {
    text-align: center;
    margin-bottom: 40px;
}

.platform-intro h2 {
    font-size: 2.2rem;
    color: #2c3e50;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.platform-intro h2 i {
    color: #3498db;
}

.intro-text {
    font-size: 1.2rem;
    color: #555;
    max-width: 800px;
    margin: 0 auto;
}

/* 模块卡片网格 */
.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.module-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.07);
    border: 1px solid #eee;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.module-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
    border-color: #3498db;
}

.card-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.card-icon i {
    font-size: 1.8rem;
    color: white;
}

.card-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 12px;
}

.card-description {
    font-size: 1rem;
    color: #666;
    line-height: 1.5;
    margin-bottom: 20px;
    flex: 1;
}

/* 实验列表 */
.experiment-list {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
}

.experiment-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: white;
    border-radius: 8px;
    margin-bottom: 10px;
    border: 1px solid #eee;
    transition: all 0.2s ease;
}

.experiment-item:last-child {
    margin-bottom: 0;
}

.experiment-item:hover {
    border-color: #3498db;
    background: #f0f7ff;
}

.experiment-item i {
    color: #3498db;
    font-size: 1rem;
    width: 20px;
}

.experiment-link {
    flex: 1;
    color: #2c3e50;
    text-decoration: none;
    font-weight: 500;
    font-size: 1rem;
}

.experiment-link:hover {
    color: #3498db;
    text-decoration: underline;
}

.experiment-text {
    flex: 1;
    color: #777;
    font-size: 1rem;
}

.experiment-tag {
    background: #e8f4fc;
    color: #2980b9;
    font-size: 0.8rem;
    padding: 3px 8px;
    border-radius: 12px;
    font-weight: 500;
}

.experiment-item.placeholder {
    background: #f9f9f9;
    border-style: dashed;
    border-color: #ccc;
    color: #888;
}

/* 卡片页脚 */
.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.status {
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.status i {
    font-size: 0.7rem;
}

.status i.fa-circle {
    color: #2ecc71;
}

.module-card:nth-child(2) .status i.fa-circle {
    color: #f39c12;
}

.module-card:nth-child(3) .status i.fa-circle {
    color: #2ecc71;
}

.module-card:nth-child(4) .status i.fa-circle,
.module-card:nth-child(5) .status i.fa-circle {
    color: #95a5a6;
}

/* 页脚 */
.footer {
    background: #f8f9fa;
    padding: 25px 30px;
    border-top: 1px solid #eee;
    margin-top: auto;
}

.footer-content {
    text-align: center;
}

.footer-content p {
    margin-bottom: 10px;
    color: #555;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.footer-content i {
    color: #3498db;
}

.footer-note {
    font-size: 0.9rem;
    color: #777;
    line-height: 1.4;
    max-width: 800px;
    margin: 0 auto;
}

/* 响应式设计 */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .container {
        min-height: calc(100vh - 20px);
        border-radius: 15px;
    }

    .header {
        padding: 30px 20px 25px;
    }

    .logo {
        gap: 12px;
    }

    .logo i {
        font-size: 2.8rem;
    }

    .logo h1 {
        font-size: 2.8rem;
    }

    .tagline {
        font-size: 1.5rem;
    }

    .description {
        font-size: 1rem;
    }

    .main-content {
        padding: 30px 20px;
    }

    .platform-intro h2 {
        font-size: 1.8rem;
    }

    .intro-text {
        font-size: 1.1rem;
    }

    .module-grid {
        grid-template-columns: 1fr;
        gap: 25px;
    }

    .module-card {
        padding: 20px;
    }

    .header-top {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
        margin-bottom: 20px;
    }

    .user-nav-content {
        align-items: stretch;
    }

    .user-nav-buttons {
        justify-content: center;
        flex-wrap: wrap;
    }

    .nav-btn {
        padding: 8px 14px;
        font-size: 0.9rem;
    }

    .hero-hint {
        font-size: 0.85rem;
        margin-top: 15px;
    }

    .footer {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .logo i {
        font-size: 2.2rem;
    }

    .logo h1 {
        font-size: 2.2rem;
    }

    .tagline {
        font-size: 1.3rem;
    }

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

    .card-icon i {
        font-size: 1.5rem;
    }

    .card-title {
        font-size: 1.3rem;
    }
}

/* 超小屏幕优化（iPhone SE等） */
@media (max-width: 380px) {
    .module-card {
        padding: 15px;
    }

    .experiment-item {
        padding: 8px;
        font-size: 0.9rem;
    }

    .experiment-link {
        font-size: 0.95rem;
        word-wrap: break-word;
        hyphens: auto;
    }

    .experiment-text {
        word-wrap: break-word;
        hyphens: auto;
    }

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

    .card-icon i {
        font-size: 1.3rem;
    }
}

/* 模块入口按钮样式 */
.module-action {
    margin: 20px 0 25px;
    text-align: center;
}

.module-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(52, 152, 219, 0.2);
}

.module-action-btn:hover {
    background: linear-gradient(135deg, #2980b9 0%, #1c5a7a 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(52, 152, 219, 0.3);
}

.module-action-btn:active {
    transform: translateY(0);
}

.module-action-btn.disabled {
    background: linear-gradient(135deg, #95a5a6 0%, #7f8c8d 100%);
    cursor: not-allowed;
    box-shadow: none;
}

.module-action-btn.disabled:hover {
    transform: none;
    box-shadow: none;
    background: linear-gradient(135deg, #95a5a6 0%, #7f8c8d 100%);
}

.module-action-btn i {
    font-size: 0.95rem;
}

/* 移除旧的experiment-list样式（首页不再需要） */
.module-card .experiment-list {
    display: none;
}

/* 用户访问区域样式 */
.user-access-area {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 14px 18px;
    margin-top: 22px;
    position: relative;
    z-index: 1;
    max-width: 550px;
    margin-left: auto;
    margin-right: auto;
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.07);
}

.user-access-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.auth-buttons-group {
    display: flex;
    gap: 8px;
}

.user-access-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 12px;
}

.user-status-section {
    flex: 1;
    min-width: 0; /* 防止内容溢出 */
}

.user-actions-section {
    flex-shrink: 0;
}

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

.logged-in-actions {
    display: flex;
    gap: 8px;
}

.workspace-btn {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.5);
}

.workspace-btn:hover {
    background: linear-gradient(135deg, #2980b9 0%, #1c5a7a 100%);
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(52, 152, 219, 0.3);
}

.profile-btn {
    background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.5);
}

.profile-btn:hover {
    background: linear-gradient(135deg, #8e44ad 0%, #7d3c98 100%);
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(155, 89, 182, 0.3);
}

.access-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
    justify-content: center;
}

.guest-btn {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.3) 0%, rgba(255, 255, 255, 0.2) 100%);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.4);
}

.guest-btn:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.4) 0%, rgba(255, 255, 255, 0.3) 100%);
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(255, 255, 255, 0.1);
}

.register-btn {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.5);
}

.register-btn:hover {
    background: linear-gradient(135deg, #2980b9 0%, #1c5a7a 100%);
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(52, 152, 219, 0.3);
}

.login-btn {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.5);
}

.login-btn:hover {
    background: linear-gradient(135deg, #27ae60 0%, #219653 100%);
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(46, 204, 113, 0.3);
}

.user-status-info {
    text-align: left;
    font-size: 0.9rem;
    opacity: 0.9;
    padding: 4px 0;
    line-height: 1.4;
}

#userWelcome {
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}

#welcomeText {
    font-weight: 600;
    color: #fff;
}

.logout-link {
    color: #ff6b6b;
    text-decoration: none;
    font-size: 0.9rem;
    margin-left: 10px;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    transition: all 0.2s ease;
}

.logout-link:hover {
    background: rgba(255, 255, 255, 0.2);
    text-decoration: underline;
}

.user-access-description {
    text-align: center;
    font-size: 0.85rem;
    opacity: 0.8;
    margin-top: 8px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    line-height: 1.4;
}

.user-access-description i {
    color: #f1c40f;
    margin-right: 6px;
}

@media (max-width: 768px) {
    .user-access-area {
        padding: 12px 14px;
        margin-top: 18px;
        max-width: 100%;
    }

    .user-access-row {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }

    .user-status-section {
        text-align: center;
    }

    .user-status-info {
        text-align: center;
        padding: 6px 0;
    }

    .user-actions-section {
        width: 100%;
    }

    .user-actions-buttons {
        justify-content: center;
        flex-wrap: wrap;
        gap: 10px;
    }

    .auth-buttons-group {
        display: flex;
        flex-direction: row;
        gap: 8px;
        justify-content: center;
    }

    .access-btn {
        min-width: 110px;
        padding: 9px 15px;
        font-size: 0.95rem;
    }

    .auth-buttons-group .access-btn {
        max-width: 120px;
    }

    .logged-in-actions {
        justify-content: center;
    }
}

/* 工作区卡片隐藏类 */
.module-card.hidden {
    display: none;
}

/* 禁用按钮样式 */
.btn-disabled, .copy-btn-disabled {
    opacity: 0.6;
    cursor: not-allowed;
    position: relative;
}

.btn-disabled::after, .copy-btn-disabled::after {
    content: "请先登录或注册后使用此功能";
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
    margin-bottom: 5px;
}

.btn-disabled:hover::after, .copy-btn-disabled:hover::after {
    opacity: 1;
}

/* 平台统一导航（适用于非首页页面） */
.platform-nav-container {
    position: absolute;
    top: 20px;
    right: 30px;
    z-index: 100000;
    display: block;
    min-width: auto;
    text-align: right;
}

/* Hero 内容约束容器 - 确保内部元素不溢出 */
.list-page-header,
.topic-page-header {
    position: relative;
    padding-right: 220px; /* 为右上角账号区预留空间 */
}
.platform-nav-container .user-nav-content {
    align-items: flex-end;
}

.platform-nav-container .user-status-light {
    text-align: right;
    color: #2c3e50;
    margin-bottom: 4px;
    font-size: 0.9rem;
}

/* ========== 右上角导航按钮（全站唯一样式源） ========== */
.platform-nav-container .nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    color: white;
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    transition: all 0.2s ease;
    text-shadow: none;
}

.platform-nav-container .nav-btn:hover {
    background: rgba(255, 255, 255, 0.22);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.platform-nav-container .nav-btn i {
    font-size: 0.85rem;
    opacity: 0.95;
}

/* 按钮语义色 */
.platform-nav-container .guest-nav-btn {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.platform-nav-container .login-nav-btn {
    background: rgba(46, 204, 113, 0.15);
    border-color: rgba(46, 204, 113, 0.3);
}

.platform-nav-container .register-nav-btn {
    background: rgba(52, 152, 219, 0.15);
    border-color: rgba(52, 152, 219, 0.3);
}

.platform-nav-container .workspace-nav-btn {
    background: rgba(52, 152, 219, 0.15);
    border-color: rgba(52, 152, 219, 0.3);
}

.platform-nav-container .profile-nav-btn {
    background: rgba(155, 89, 182, 0.15);
    border-color: rgba(155, 89, 182, 0.3);
}

.platform-nav-container .logout-nav-btn {
    background: rgba(231, 76, 60, 0.1);
    border-color: rgba(231, 76, 60, 0.25);
}

/* 深色头部背景下的用户状态文字样式（只影响文字，不影响按钮） */
.template-header .platform-nav-container .user-status-light,
.workspace-header .platform-nav-container .user-status-light,
.profile-header .platform-nav-container .user-status-light,
.experiment-header .platform-nav-container .user-status-light,
.copy-header .platform-nav-container .user-status-light,
.demo-header .platform-nav-container .user-status-light,
.mobile-header .platform-nav-container .user-status-light {
    color: white;
    font-weight: 700;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    font-size: 1rem;
}


/* 响应式调整 */
@media (max-width: 768px) {
    .platform-nav-container {
        position: static;
        margin-bottom: 15px;
        display: flex;
        justify-content: center;
        min-width: unset;
        width: 100%;
    }

/* Hero 内容约束容器 - 确保内部元素不溢出 */
.list-page-header,
.topic-page-header {
    position: relative;
    padding-right: 220px; /* 为右上角账号区预留空间 */
}
    .platform-nav-container .user-nav-content {
        align-items: center;
    }

    .platform-nav-container .user-status-light {
        text-align: center;
    }
}
/* 首页 Hero 内的平台导航（相对定位） */
.hero-shell--homepage .platform-nav-container {
    position: static;
    z-index: 10;
}

.hero-shell--homepage .user-nav {
    z-index: 11;
}

.hero-shell--homepage .nav-btn {
    pointer-events: auto;
}
