* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 0 20px;
    flex: 1;
}

/* Header */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px 0;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    width: 100%;
}

header h1 {
    font-size: clamp(1.8em, 4vw, 2.5em);
    margin-bottom: 10px;
}

.subtitle {
    font-size: clamp(0.9em, 2vw, 1.1em);
    opacity: 0.9;
}

/* Main Content */
main {
    padding: 40px 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.courses {
    width: 100%;
    max-width: 1200px;
}

.courses h2 {
    text-align: center;
    font-size: clamp(1.5em, 3vw, 2em);
    margin-bottom: 30px;
    color: #333;
}

.course-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
    gap: 30px;
    margin-top: 30px;
    width: 100%;
    justify-items: center;
}

.course-card {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
}

.course-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

.course-image {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    display: block;
    cursor: pointer;
    transition: opacity 0.3s;
}

.course-image:hover {
    opacity: 0.9;
}

.course-info {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.course-info h3 {
    margin-bottom: 10px;
}

.course-info h3 a {
    color: #333;
    text-decoration: none;
    font-size: clamp(1.1em, 2.5vw, 1.3em);
}

.course-info h3 a:hover {
    color: #667eea;
}

.course-desc {
    color: #666;
    margin-bottom: 15px;
    font-size: clamp(0.85em, 2vw, 0.95em);
    min-height: 40px;
    flex: 1;
}

.course-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    font-size: clamp(0.8em, 2vw, 0.9em);
    color: #999;
    flex-wrap: wrap;
    gap: 10px;
}

.course-price {
    font-size: clamp(1.2em, 3vw, 1.5em);
    color: #e74c3c;
    font-weight: bold;
    margin-bottom: 15px;
}

.btn-buy {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 30px;
    text-decoration: none;
    border-radius: 5px;
    text-align: center;
    width: 100%;
    transition: opacity 0.3s;
    font-size: clamp(0.9em, 2vw, 1em);
}

.btn-buy:hover {
    opacity: 0.9;
}

/* Detail Page */
.detail-container {
    background: white;
    padding: clamp(20px, 4vw, 40px);
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin: 30px auto;
    max-width: 1000px;
    width: 100%;
}

.detail-header {
    margin-bottom: 30px;
    text-align: center;
}

.detail-header h1 {
    font-size: clamp(1.8em, 4vw, 2.5em);
    color: #333;
    margin-bottom: 10px;
}

.detail-price {
    font-size: clamp(1.5em, 3vw, 2em);
    color: #e74c3c;
    font-weight: bold;
    margin: 20px 0;
}

.detail-images {
    margin: 30px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.detail-images img {
    width: 100%;
    max-width: 600px;
    height: auto;
    aspect-ratio: 3 / 2;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    object-fit: cover;
}

.detail-content {
    margin: 30px 0;
    line-height: 1.8;
}

.detail-content h2 {
    color: #667eea;
    margin: 30px 0 15px 0;
    font-size: clamp(1.2em, 2.5vw, 1.5em);
}

.detail-content p {
    margin-bottom: 15px;
    color: #555;
    font-size: clamp(0.9em, 2vw, 1em);
}

.detail-content ul {
    margin-left: 30px;
    margin-bottom: 20px;
}

.detail-content li {
    margin-bottom: 10px;
    color: #555;
    font-size: clamp(0.9em, 2vw, 1em);
}

.reviews {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid #eee;
}

.reviews h2 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: clamp(1.2em, 2.5vw, 1.5em);
}

.review-item {
    background: #f9f9f9;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.review-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 10px;
}

.review-user {
    font-weight: bold;
    color: #333;
}

.review-date {
    color: #999;
    font-size: clamp(0.8em, 1.8vw, 0.9em);
}

.review-rating {
    color: #f39c12;
    margin: 10px 0;
}

.review-content {
    color: #555;
    line-height: 1.6;
    font-size: clamp(0.9em, 2vw, 1em);
}

.back-link {
    display: inline-block;
    margin: 20px 0;
    color: #667eea;
    text-decoration: none;
    font-size: clamp(1em, 2vw, 1.1em);
}

.back-link:hover {
    text-decoration: underline;
}

/* Order Page */
.order-container {
    background: white;
    padding: clamp(20px, 4vw, 40px);
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin: 30px auto;
    max-width: 800px;
    width: 100%;
}

.order-container h1 {
    margin-bottom: 30px;
    color: #333;
    text-align: center;
    font-size: clamp(1.5em, 3vw, 2em);
}

.order-item {
    display: flex;
    align-items: center;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.order-item img {
    width: 120px;
    height: auto;
    aspect-ratio: 3 / 2;
    object-fit: cover;
    border-radius: 5px;
    flex-shrink: 0;
}

.order-item-info {
    flex: 1;
    min-width: 200px;
}

.order-item-info h3 {
    margin-bottom: 10px;
    font-size: clamp(1em, 2.5vw, 1.2em);
}

.order-item-price {
    font-size: clamp(1.1em, 2.5vw, 1.3em);
    color: #e74c3c;
    font-weight: bold;
}

.order-info {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
}

.order-info-item {
    font-size: clamp(1em, 2.2vw, 1.1em);
    color: #333;
}

.order-info-item strong {
    color: #667eea;
    margin-right: 8px;
}

.order-info-item span {
    color: #e74c3c;
    font-weight: bold;
    font-family: 'Courier New', monospace;
}

.order-form {
    margin-top: 30px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: bold;
    font-size: clamp(0.9em, 2vw, 1em);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: clamp(0.9em, 2vw, 1em);
    font-family: inherit;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.btn-submit {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 40px;
    border: none;
    border-radius: 5px;
    font-size: clamp(1em, 2.2vw, 1.1em);
    cursor: pointer;
    width: 100%;
    transition: opacity 0.3s;
}

.btn-submit:hover {
    opacity: 0.9;
}

.total-price {
    text-align: right;
    font-size: clamp(1.2em, 3vw, 1.5em);
    color: #e74c3c;
    font-weight: bold;
    margin: 20px 0;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
}

/* Footer */
footer {
    background: #333;
    color: white;
    text-align: center;
    padding: 30px 0;
    margin-top: 50px;
    width: 100%;
}

footer p {
    margin: 5px 0;
    font-size: clamp(0.85em, 2vw, 1em);
}

/* 侧边在线客服 */
.customer-service {
    position: fixed;
    bottom: 140px;
    right: 24px;
    transform: none;
    z-index: 1200;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.customer-service:hover {
    transform: translateY(-2px);
}

.cs-toggle {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: bold;
    letter-spacing: 2px;
    box-shadow: 0 6px 18px rgba(102, 126, 234, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.6);
    font-size: 11px;
}

.cs-panel {
    position: absolute;
    right: 80px;
    top: 50%;
    transform: translateY(-50%) translateX(10px);
    padding: 10px 14px;
    color: #333;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 26px rgba(15, 23, 42, 0.22);
    min-width: 180px;
    opacity: 0;
    pointer-events: none;
    transition: all 0.25s ease;
}

.customer-service:hover .cs-panel {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(-50%) translateX(0);
}

.cs-panel p {
    margin: 3px 0;
    font-size: 12px;
}

.cs-panel a {
    color: #667eea;
    text-decoration: none;
}

.cs-panel a:hover {
    text-decoration: underline;
}

.cs-btn {
    display: inline-block;
    margin-top: 10px;
    padding: 7px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff !important;
    border-radius: 20px;
    font-size: 12px;
    text-decoration: none;
}

.cs-btn:hover {
    opacity: 0.9;
}

@media (max-width: 768px) {
    .customer-service {
        bottom: 90px;
        right: 18px;
    }

    .cs-panel {
        right: 72px;
        min-width: 170px;
    }
}

/* 返回顶部按钮 */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: clamp(45px, 5vw, 50px);
    height: clamp(45px, 5vw, 50px);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    z-index: 1000;
}

.back-to-top:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.back-to-top.show {
    display: flex;
}

.back-to-top svg {
    width: clamp(20px, 3vw, 24px);
    height: clamp(20px, 3vw, 24px);
    fill: white;
}

/* Responsive */
@media (max-width: 768px) {
    .course-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .container {
        padding: 0 15px;
    }
    
    main {
        padding: 20px 0;
    }
    
    .detail-container,
    .order-container {
        padding: 20px;
        margin: 20px auto;
    }
    
    .back-to-top {
        bottom: 20px;
        right: 20px;
    }
    
    .order-item {
        flex-direction: column;
        text-align: center;
    }
    
    .order-item img {
        width: 100%;
        max-width: 200px;
    }
}

@media (max-width: 480px) {
    header {
        padding: 20px 0;
    }
    
    .course-card {
        max-width: 100%;
    }
    
    .detail-images img {
        max-width: 100%;
    }
}

/* 确保内容始终居中 */
body > * {
    width: 100%;
}

main > * {
    width: 100%;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}
