* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f8f9fa;
    color: #212529;
    line-height: 1.6;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Header */
.header {
    background: #fff;
    border-bottom: 1px solid #e9ecef;
    padding: 24px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.header h1 {
    font-size: 1.75rem;
    color: #212529;
    margin-bottom: 8px;
    font-weight: 600;
}

.header-info {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    color: #6c757d;
    font-size: 0.9rem;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Main Layout */
.main-layout {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 24px;
    padding-top: 24px;
    padding-bottom: 40px;
}

/* Course Content */
.course-content {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.week-card {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    height: fit-content;
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.week-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    transform: translateY(-2px) translateZ(0);
}

/* Week Card Color Variants */
.week-card-1 {
    border-left: 4px solid #3b82f6;
}

.week-card-1 .week-number {
    background: #3b82f6;
}

.week-card-2 {
    border-left: 4px solid #10b981;
}

.week-card-2 .week-number {
    background: #10b981;
}

.week-card-3 {
    border-left: 4px solid #8b5cf6;
}

.week-card-3 .week-number {
    background: #8b5cf6;
}

.week-card-4 {
    border-left: 4px solid #f59e0b;
}

.week-card-4 .week-number {
    background: #f59e0b;
}

.week-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    cursor: pointer;
    background: #fff;
    transition: background-color 0.15s ease-out;
    will-change: background-color;
}

.week-header:hover {
    background: #f8f9fa;
}

.week-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.week-number {
    background: #4a5568;
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    min-width: 70px;
    text-align: center;
    white-space: nowrap;
}

.project-card .week-number {
    background: #2563eb;
}

.week-info h3 {
    font-size: 1rem;
    color: #212529;
    font-weight: 600;
    line-height: 1.3;
}

.arrow {
    color: #6c757d;
    font-size: 1rem;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.week-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-top: 1px solid #e9ecef;
    will-change: max-height, padding;
}

.week-body.active {
    max-height: 2000px;
    padding: 16px;
}

.live-count {
    display: inline-block;
    background: #e9ecef;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.85rem;
    color: #495057;
    margin-bottom: 16px;
    font-weight: 500;
}

.class-detail {
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f1f3f5;
}

.class-detail:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.class-detail h4 {
    font-size: 0.95rem;
    color: #212529;
    margin-bottom: 6px;
    font-weight: 600;
    line-height: 1.4;
}

.class-detail p {
    color: #6c757d;
    font-size: 0.85rem;
    line-height: 1.5;
}

.class-detail strong {
    color: #495057;
}

.project-tag {
    background: #2563eb;
    color: #fff;
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    margin-top: 12px;
    display: inline-block;
}

/* Sidebar */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: sticky;
    top: 110px;
    height: fit-content;
}

.sidebar-card {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
}

.sidebar-card h3 {
    font-size: 1.2rem;
    color: #212529;
    margin-bottom: 8px;
    font-weight: 600;
}

.sidebar-card p {
    color: #6c757d;
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.subtitle {
    margin-bottom: 20px !important;
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 0.9rem;
    margin-bottom: 12px;
    transition: border-color 0.15s ease-out, box-shadow 0.15s ease-out;
    will-change: border-color;
}

.form-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.btn-submit {
    width: 100%;
    background: #2563eb;
    color: #fff;
    border: none;
    padding: 11px 20px;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease-out, transform 0.1s ease;
    will-change: background-color, transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.btn-submit:hover {
    background: #1d4ed8;
    transform: translateY(-1px) translateZ(0);
}

.btn-submit:active {
    transform: translateY(0) translateZ(0);
    transition: transform 0.05s ease;
}

/* Leaderboard */
.leaderboard {
    max-height: calc(100vh - 400px);
    overflow-y: auto;
}

.leader-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.leader-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.2s ease-out;
    will-change: transform, background-color;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.leader-item:hover {
    background: #e9ecef;
    transform: translateX(2px) translateZ(0);
}

.leader-item.rank-1 {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
}

.leader-item.rank-2 {
    background: linear-gradient(135deg, #c0c0c0 0%, #d3d3d3 100%);
}

.leader-item.rank-3 {
    background: linear-gradient(135deg, #cd7f32 0%, #e6a85c 100%);
}

.leader-item .rank {
    font-weight: 700;
    font-size: 0.95rem;
    min-width: 40px;
    color: #495057;
}

.rank-1 .rank,
.rank-2 .rank,
.rank-3 .rank {
    color: #212529;
}

.leader-item .info {
    flex: 1;
}

.leader-item .name {
    font-weight: 600;
    color: #212529;
    font-size: 0.95rem;
    margin-bottom: 2px;
}

.leader-item .stats {
    color: #6c757d;
    font-size: 0.8rem;
}

.rank-1 .stats,
.rank-2 .stats,
.rank-3 .stats {
    color: #495057;
}

.update-info {
    text-align: center;
    margin-top: 16px;
    color: #6c757d;
    font-size: 0.85rem;
}

/* Footer */
.footer {
    background: #fff;
    border-top: 1px solid #e9ecef;
    padding: 20px;
    text-align: center;
    color: #6c757d;
    font-size: 0.9rem;
}

/* Scrollbar */
.leaderboard {
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.leaderboard::-webkit-scrollbar {
    width: 6px;
}

.leaderboard::-webkit-scrollbar-track {
    background: #f1f3f5;
    border-radius: 10px;
}

.leaderboard::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 10px;
    transition: background-color 0.2s ease;
}

.leaderboard::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .course-content {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1024px) {
    .main-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: relative;
        top: 0;
    }

    .leaderboard {
        max-height: 500px;
    }
    
    .course-content {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }

    .header {
        padding: 16px 0;
    }

    .header h1 {
        font-size: 1.3rem;
    }

    .header-info {
        font-size: 0.8rem;
        gap: 10px;
        flex-wrap: wrap;
    }

    .main-layout {
        padding-top: 16px;
        gap: 20px;
    }
    
    .course-content {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .week-card {
        margin-bottom: 0;
    }

    .week-header {
        padding: 14px;
    }

    .week-info {
        gap: 10px;
    }

    .week-number {
        min-width: 60px;
        font-size: 0.75rem;
        padding: 6px 8px;
    }

    .week-info h3 {
        font-size: 0.9rem;
    }

    .arrow {
        font-size: 0.9rem;
    }

    .week-body.active {
        padding: 14px;
    }

    .live-count {
        font-size: 0.8rem;
        padding: 4px 10px;
        margin-bottom: 12px;
    }

    .class-detail {
        margin-bottom: 12px;
        padding-bottom: 10px;
    }

    .class-detail h4 {
        font-size: 0.9rem;
    }

    .class-detail p {
        font-size: 0.8rem;
    }

    .project-tag {
        font-size: 0.85rem;
        padding: 8px 12px;
    }

    .sidebar {
        margin-top: 0;
    }

    .sidebar-card {
        padding: 16px;
    }

    .sidebar-card h3 {
        font-size: 1.1rem;
    }

    .leader-list {
        gap: 8px;
    }

    .leader-item {
        padding: 10px;
    }

    .leader-item .rank {
        font-size: 0.85rem;
        min-width: 35px;
    }

    .leader-item .name {
        font-size: 0.85rem;
    }

    .leader-item .stats {
        font-size: 0.75rem;
    }

    .footer {
        padding: 16px;
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.1rem;
    }

    .header-info {
        font-size: 0.75rem;
        gap: 8px;
    }

    .header-info span {
        display: block;
        width: 100%;
        text-align: center;
    }

    .main-layout {
        padding-top: 12px;
        padding-bottom: 20px;
    }

    .week-number {
        min-width: 55px;
        font-size: 0.7rem;
        padding: 5px 6px;
    }

    .week-info h3 {
        font-size: 0.85rem;
    }

    .class-detail h4 {
        font-size: 0.85rem;
    }

    .class-detail p {
        font-size: 0.75rem;
    }

    .sidebar-card h3 {
        font-size: 1rem;
    }

    .form-input {
        font-size: 0.85rem;
        padding: 9px 12px;
    }

    .btn-submit {
        font-size: 0.9rem;
        padding: 10px 16px;
    }
}

/* Locked Section Styles */
.locked-section {
    position: relative;
    overflow: hidden;
}

.locked-content {
    filter: blur(4px);
    pointer-events: none;
    user-select: none;
}

.lock-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(2px);
}

.lock-icon {
    font-size: 3rem;
    margin-bottom: 8px;
    animation: lockPulse 2s ease-in-out infinite;
}

.lock-message {
    font-size: 1rem;
    font-weight: 600;
    color: #495057;
    text-align: center;
    padding: 0 20px;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

@keyframes lockPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.9;
    }
    50% {
        transform: scale(1.1);
        opacity: 1;
    }
}

@media print {
    .sidebar,
    .footer {
        display: none;
    }

    .main-layout {
        grid-template-columns: 1fr;
    }

    .week-body {
        max-height: none !important;
        padding: 20px !important;
    }
}