* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

body {
    background: #f5f7fa;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 1.5rem;
    color: #2c3e50;
    line-height: 1.5;
}

.container {
    max-width: 1200px;
    width: 100%;
}

/* 头部样式 */
.header {
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 1rem 1.5rem;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}

.header h1 {
    color: #1e293b;
    font-size: 1.8rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.header p {
    color: #64748b;
    font-size: 0.9rem;
    margin-top: 0.2rem;
    white-space: nowrap;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.user-info span {
    color: #475569;
    white-space: nowrap;
}

.user-info .nickname {
    font-weight: 600;
    color: #3b82f6;
    background: #eff6ff;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
}

.login-btn, .register-btn, .logout-btn {
    background: #f8fafc;
    color: #334155;
    border: 1px solid #e2e8f0;
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 0.9rem;
    border-radius: 8px;
    transition: all 0.2s;
    font-weight: 500;
    white-space: nowrap;
}

.login-btn:hover, .register-btn:hover, .logout-btn:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

/* 报名区域 */
.signup-section {
    background: white;
    border-radius: 24px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.02);
}

.section-title {
    color: #0f172a;
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-title::before {
    font-size: 1.4rem;
}

.squad {
    margin-bottom: 2rem;
}

.squad:last-child {
    margin-bottom: 0;
}

.squad h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.squad h3::before {
    font-size: 1.1rem;
}

/* 团长显示 */
.squad-commanders {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.commander-tag {
    background: #f1f5f9;
    color: #475569;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.commander-tag::before {
    content: "👑";
    color: #f59e0b;
}

/* 队伍网格 */
.team-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.6rem;
}

/* 队伍卡片 */
.team-card {
    background: #ffffff;
    border: 1px solid #f1f5f9;
    border-radius: 12px;
    padding: 0.8rem;
    transition: all 0.2s;
}

.team-card:hover {
    border-color: #e2e8f0;
    box-shadow: 0 3px 9px rgba(0,0,0,0.02);
}

.team-card.my-team {
    background: #f0f9ff;
    border-color: #bae6fd;
}

/* 队伍头部 */
.team-header {
    margin-bottom: 0.6rem;
}

.team-number {
    color: #94a3b8;
    font-size: 0.64rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

/* 位置网格 */
.team-slots {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.32rem;
    margin-bottom: 0.4rem;
}

/* 位置卡片 */
.slot {
    background: #f8fafc;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem 0.2rem;
    font-size: 0.6rem;
    aspect-ratio: 1;
    text-align: center;
    border: 1px solid transparent;
}

.slot.occupied {
    background: #eef2ff;
    color: #1e293b;
}

.slot.occupied.my-slot {
    background: #dbeafe;
    border-color: #93c5fd;
}

.slot.empty {
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    color: #94a3b8;
}

.slot.empty:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
    cursor: pointer;
}

.slot-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    gap: 0.08rem;
}

.slot-name {
    color: #1e293b;
    font-size: 0.56rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.slot-class {
    color: #64748b;
    font-size: 0.48rem;
    background: #e2e8f0;
    padding: 0.08rem 0.24rem;
    border-radius: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.plus-icon {
    color: #3b82f6;
    font-size: 0.8rem;
    font-weight: 500;
}

/* 取消报名按钮 */
.cancel-btn {
    width: 100%;
    padding: 0.32rem;
    background: #fee2e2;
    color: #b91c1c;
    border: none;
    border-radius: 6px;
    font-size: 0.56rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.cancel-btn:hover {
    background: #fecaca;
}

/* 报名底部 */
.signup-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1.6rem;
    margin-top: 1.2rem;
    color: #64748b;
    font-size: 0.68rem;
}

/* 底部导航 */
.bottom-nav {
    background: white;
    border-radius: 16px;
    padding: 1rem 1.5rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-item {
    color: #64748b;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s;
}

.nav-item:hover {
    color: #334155;
}

.nav-item.active {
    color: #3b82f6;
    font-weight: 600;
}

.online-badge {
    color: #3b82f6;
    font-size: 0.9rem;
    font-weight: 500;
    background: #eff6ff;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
}

.footer-note {
    margin-top: 1.5rem;
    color: #94a3b8;
    font-size: 0.8rem;
    text-align: center;
}

/* 模态框样式 - 修复上下居中问题 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    
    /* 使用flex实现完美居中 */
    display: none;
    justify-content: center;
    align-items: center;
    
    /* 确保内容垂直居中 */
    margin: 0;
    padding: 0;
}

/* 确保模态框内容垂直居中 */
.modal[style*="display: block"] {
    display: flex !important;
}

.modal-content {
    background: white;
    padding: 2rem;
    width: 90%;
    max-width: 400px;
    border-radius: 24px;
    position: relative;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    
    /* 确保内容块本身也居中 */
    margin: 0 auto;
    
    /* 防止内容溢出 */
    max-height: 90vh;
    overflow-y: auto;
}

.close {
    position: absolute;
    right: 1.5rem;
    top: 1.5rem;
    font-size: 1.2rem;
    color: #94a3b8;
    cursor: pointer;
    transition: color 0.2s;
    line-height: 1;
    z-index: 1001;
}

.close:hover {
    color: #334155;
}

.modal h2 {
    color: #1e293b;
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    padding-right: 2rem;
}

.modal input {
    width: 100%;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    color: #1e293b;
    font-size: 0.9rem;
}

.modal input:focus {
    outline: none;
    border-color: #3b82f6;
    background: white;
}

.modal button {
    width: 100%;
    padding: 0.75rem;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.modal button:hover {
    background: #2563eb;
}

.modal-footer {
    margin-top: 1.5rem;
    color: #64748b;
    text-align: center;
    font-size: 0.9rem;
}

.modal-footer span {
    color: #3b82f6;
    font-weight: 600;
    cursor: pointer;
}

/* 提示消息 */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 24px;
    background: white;
    color: #1e293b;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 2000;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    border-left: 4px solid #3b82f6;
}

.toast.success {
    border-left-color: #10b981;
}

.toast.error {
    border-left-color: #ef4444;
}

.toast.info {
    border-left-color: #3b82f6;
}

/* 加载动画 */
.loading {
    text-align: center;
    padding: 40px;
    color: #94a3b8;
}

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

/* 响应式设计 */
@media (max-width: 1024px) {
    .team-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
    }
}

@media (max-width: 768px) {
    .team-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* 小屏幕下 header 保持一行，元素放大 */
    .header {
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 1.5rem;
        padding: 1rem 1.2rem;
    }
    
    .header h1 {
        font-size: 1.8rem;
    }
    
    .header p {
        font-size: 1.1rem;
        margin-top: 0;
    }
    
    .user-info {
        gap: 1.5rem;
        transform: scale(1.1);
        transform-origin: right center;
    }
    
    .user-info .nickname {
        padding: 0.4rem 1rem;
        font-size: 1.1rem;
    }
    
    .login-btn, .register-btn, .logout-btn {
        padding: 0.5rem 1rem;
        font-size: 1.1rem;
    }
}

@media (max-width: 600px) {
    body {
        padding: 0.5rem;
    }
    
    /* header 保持一行，元素放大50% */
    .header {
        padding: 0.8rem 1rem;
        margin-bottom: 1rem;
        gap: 1.2rem;
    }
    
    .header h1 {
        font-size: 1.5rem;
    }
    
    .header p {
        font-size: 1rem;
    }
    
    .user-info {
        transform: scale(1.2);
        gap: 1.2rem;
    }
    
    .user-info .nickname {
        padding: 0.4rem 0.9rem;
        font-size: 1rem;
    }
    
    .login-btn, .register-btn, .logout-btn {
        padding: 0.4rem 0.9rem;
        font-size: 1rem;
    }
    
    .signup-section {
        padding: 0.8rem;
    }
    
    .team-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 0.2rem;
    }
    
    .team-card {
        padding: 0.4rem;
    }
    
    .team-number {
        font-size: 0.5rem;
    }
    
    .team-slots {
        grid-template-columns: 1fr;
        gap: 0.15rem;
    }
    
    .slot {
        aspect-ratio: auto;
        min-height: 28px;
        flex-direction: row;
        justify-content: flex-start;
        padding: 0.2rem 0.4rem;
    }
    
    .slot-content {
        flex-direction: row;
        gap: 0.2rem;
        justify-content: flex-start;
    }
    
    .slot-name {
        font-size: 0.5rem;
    }
    
    .slot-class {
        font-size: 0.4rem;
        padding: 0.05rem 0.15rem;
    }
    
    .plus-icon {
        font-size: 0.7rem;
        margin-left: auto;
    }
    
    .cancel-btn {
        padding: 0.15rem;
        font-size: 0.45rem;
    }
    
    /* 小屏幕模态框适配 */
    .modal-content {
        width: 95%;
        padding: 1.5rem;
        max-height: 85vh;
    }
}

@media (max-width: 480px) {
    .team-grid {
        gap: 0.15rem;
    }
    
    .team-card {
        padding: 0.3rem;
    }
    
    .slot {
        min-height: 24px;
        padding: 0.15rem 0.3rem;
    }
    
    .slot-name {
        font-size: 0.45rem;
    }
    
    .slot-class {
        font-size: 0.35rem;
        padding: 0.05rem 0.1rem;
    }
    
    /* 超小屏幕 header 元素继续放大 */
    .header {
        padding: 0.6rem 0.8rem;
        gap: 1rem;
    }
    
    .header h1 {
        font-size: 1.3rem;
    }
    
    .header p {
        font-size: 0.9rem;
    }
    
    .user-info {
        transform: scale(1.1);
        gap: 1rem;
    }
}

@media (max-width: 400px) {
    .slot {
        min-height: 22px;
        padding: 0.1rem 0.25rem;
    }
    
    .slot-name {
        font-size: 0.4rem;
    }
    
    .slot-class {
        font-size: 0.3rem;
    }
    
    /* 最小屏幕 header 保持可读性 */
    .header {
        padding: 0.5rem 0.7rem;
        gap: 0.8rem;
    }
    
    .header h1 {
        font-size: 1.1rem;
    }
    
    .header p {
        font-size: 0.8rem;
    }
    
    .user-info {
        transform: scale(1);
        gap: 0.8rem;
    }
    
    .user-info .nickname {
        padding: 0.3rem 0.7rem;
        font-size: 0.9rem;
    }
    
    .login-btn, .register-btn, .logout-btn {
        padding: 0.3rem 0.7rem;
        font-size: 0.9rem;
    }
}