:root {
    --color-primary: #2563eb;
    --color-primary-dark: #1e40af;
    --color-bg: #ffffff;
    --color-surface: #f8fafc;
    --color-border: #e2e8f0;
    --color-text: #1e293b;
    --color-text-muted: #64748b;
    --color-text-light: #94a3b8;
    --color-accent-a0: #8b5cf6;
    --color-accent-a2: #06b6d4;
    --color-accent-b1: #10b981;
    --color-accent-b2: #f59e0b;
    --color-accent-c1: #ef4444;
    --color-accent-c2: #ec4899;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1);
}

[data-theme="dark"] {
    --color-bg: #0f172a;
    --color-surface: #1e293b;
    --color-border: #334155;
    --color-text: #f1f5f9;
    --color-text-muted: #94a3b8;
    --color-text-light: #64748b;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
}

/* Page Management */
.page {
    display: none;
    min-height: 100vh;
}

.page.active {
    display: block;
}

/* Cover Page */
#cover-page {
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
}

#cover-page.active {
    display: flex;
}

.cover-content {
    text-align: center;
    max-width: 700px;
}

.cover-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    padding: 0.5rem 1.5rem;
    border-radius: 50px;
    font-size: 0.9rem;
    margin-bottom: 2rem;
    font-weight: 500;
}

.cover-title {
    font-size: clamp(2.5rem, 8vw, 4.5rem);
    font-weight: 800;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.cover-subtitle {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    font-weight: 300;
    margin-bottom: 3rem;
    opacity: 0.95;
}

.cover-details {
    display: flex;
    justify-content: center;
    gap: 3rem;
    margin-bottom: 3rem;
    flex-wrap: wrap;
}

.detail-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.detail-number {
    font-size: 3rem;
    font-weight: 700;
    line-height: 1;
}

.detail-label {
    font-size: 0.9rem;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.5rem;
}

.cta-button {
    background: white;
    color: #667eea;
    border: none;
    padding: 1rem 3rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: var(--shadow-xl);
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 25px 30px -5px rgb(0 0 0 / 0.2);
}

.cover-info {
    margin-top: 2rem;
    opacity: 0.9;
}

.cover-info p {
    margin: 0.25rem 0;
    font-size: 0.95rem;
}

/* Page Header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 1rem;
}

.back-button {
    background: none;
    border: 1px solid var(--color-border);
    color: var(--color-text);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    white-space: nowrap;
}

.back-button:hover {
    background: var(--color-border);
}

.theme-toggle {
    background: none;
    border: 1px solid var(--color-border);
    color: var(--color-text);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s;
}

.theme-toggle:hover {
    background: var(--color-border);
}

.search-bar {
    flex: 1;
    max-width: 500px;
}

.search-bar input {
    width: 100%;
    padding: 0.5rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-bg);
    color: var(--color-text);
    font-size: 0.9rem;
}

/* Content Wrapper */
.content-wrapper {
    max-width: 800px;
    margin: 0 auto;
    padding: 3rem 2rem;
}

.content-wrapper {
    line-height: 1.7;
}

.content-wrapper h1 {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.content-wrapper h2 {
    font-size: 1.5rem;
    margin-top: 0;
    margin-bottom: 0;
    font-weight: 600;
}

.content-wrapper h3 {
    font-size: 1.1rem;
    margin-top: 0;
    margin-bottom: 0;
    font-weight: 600;
}

.content-wrapper p {
    margin-bottom: 1rem;
}

.content-wrapper ul, .content-wrapper ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.content-wrapper strong {
    font-weight: 600;
    color: var(--color-text);
}

/* Guide Sections */
.guide-section {
    margin-bottom: 3rem;
}

.rhythm-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.rhythm-table th,
.rhythm-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

.rhythm-table th {
    background: var(--color-surface);
    font-weight: 600;
}

.stages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.stage-card {
    padding: 1.5rem;
    border-radius: 12px;
    border: 2px solid;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: default;
}

.stage-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stage-card h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.5rem;
}

.stage-weeks {
    font-size: 0.85rem;
    opacity: 0.8;
    margin-bottom: 0.5rem;
}

.stage-a0 { border-color: var(--color-accent-a0); background: rgba(139, 92, 246, 0.1); }
.stage-a2 { border-color: var(--color-accent-a2); background: rgba(6, 182, 212, 0.1); }
.stage-b1 { border-color: var(--color-accent-b1); background: rgba(16, 185, 129, 0.1); }
.stage-b2 { border-color: var(--color-accent-b2); background: rgba(245, 158, 11, 0.1); }
.stage-c1 { border-color: var(--color-accent-c1); background: rgba(239, 68, 68, 0.1); }
.stage-c2 { border-color: var(--color-accent-c2); background: rgba(236, 72, 153, 0.1); }

.info-box {
    background: var(--color-surface);
    border-left: 4px solid var(--color-primary);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-top: 1rem;
}

.checklist {
    list-style: none;
    margin-left: 0;
}

.checklist li {
    padding-left: 1.5rem;
    position: relative;
    margin-bottom: 0.5rem;
}

.checklist li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--color-primary);
    font-weight: bold;
}

/* Lessons Layout */
.lessons-layout {
    display: flex;
    min-height: calc(100vh - 65px);
}

.sidebar {
    width: 300px;
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    overflow-y: auto;
    position: sticky;
    top: 65px;
    height: calc(100vh - 65px);
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--color-border);
}

.sidebar-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
}

.stages-nav {
    padding: 1rem;
}

.stage-section {
    margin-bottom: 1.5rem;
}

.stage-button {
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    color: var(--color-text);
    font-weight: 600;
    font-size: 0.85rem;
    line-height: 1.3;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-left: 3px solid transparent;
}

.stage-button:hover {
    background: var(--color-surface);
}

.stage-button.active {
    background: var(--color-surface);
}

.stage-button small {
    font-weight: 400;
    opacity: 0.7;
    font-size: 0.7rem;
}

.expand-icon {
    font-size: 1.2rem;
    transition: transform 0.3s;
    opacity: 0.5;
}

.weeks-list {
    margin-top: 0.5rem;
    padding-left: 1rem;
}

.week-button {
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    cursor: pointer;
    color: var(--color-text-muted);
    font-size: 0.8rem;
    line-height: 1.3;
    transition: all 0.2s;
    margin-bottom: 0.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.week-button:hover {
    background: var(--color-border);
    color: var(--color-text);
}

.week-button.active {
    background: var(--color-primary);
    color: white;
    font-weight: 500;
}

.week-num {
    font-weight: 600;
    font-size: 0.75rem;
    opacity: 0.9;
}

.week-subtitle {
    font-weight: 400;
    font-size: 0.65rem;
    line-height: 1.2;
    opacity: 0.7;
    color: var(--color-text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lesson-content {
    flex: 1;
    overflow-y: auto;
    background: var(--color-bg);
}

/* Week Header */
.week-header {
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid var(--color-border);
}

.breadcrumb {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.breadcrumb-sep {
    opacity: 0.5;
}

.week-title {
    font-size: 2.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.week-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
    margin-top: 1.25rem;
}

.meta-chip {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-size: 0.85rem;
}

.meta-chip strong {
    color: var(--color-text-muted);
    font-weight: 500;
    margin-right: 0.35rem;
}

.meta-full {
    grid-column: 1 / -1;
}

/* Lesson Display */
.lesson-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 0;
    margin-bottom: 2rem;
    overflow: hidden;
}

.lesson-header {
    background: linear-gradient(135deg, var(--color-surface) 0%, var(--color-bg) 100%);
    padding: 1.75rem;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    gap: 1.25rem;
    align-items: flex-start;
}

.day-badge {
    background: var(--color-primary);
    color: white;
    padding: 0.5rem 0.85rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.day-header-content {
    flex: 1;
}

.day-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    letter-spacing: -0.01em;
}

.day-goal {
    color: var(--color-text-muted);
    font-size: 0.95rem;
    margin: 0;
    line-height: 1.5;
}

.lesson-section {
    padding: 1.75rem;
    border-bottom: 1px solid var(--color-border);
}

.lesson-section:last-of-type {
    border-bottom: none;
}

.lesson-section h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--color-text);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.section-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--color-primary);
    color: white;
    border-radius: 50%;
    font-size: 0.85rem;
    font-weight: 600;
}

.time-badge {
    margin-left: auto;
    background: var(--color-border);
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--color-text-muted);
}

.section-content {
    line-height: 1.7;
}

.section-content p {
    margin-bottom: 1rem;
}

.section-content ul {
    margin: 0.75rem 0 0.75rem 1.5rem;
}

.section-content li {
    margin-bottom: 0.5rem;
}

.info-item {
    margin-bottom: 1rem;
}

.vocab-section {
    margin: 1.25rem 0;
}

.vocab-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.vocab-item {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    font-size: 0.9rem;
    color: var(--color-text);
}

.examples-section {
    margin: 1.25rem 0;
}

.examples-list {
    margin-top: 0.75rem;
    list-style: none;
    margin-left: 0;
}

.examples-list li {
    padding-left: 1.5rem;
    position: relative;
    margin-bottom: 0.75rem;
}

.examples-list li::before {
    content: "→";
    position: absolute;
    left: 0;
    color: var(--color-primary);
    font-weight: bold;
}

.checkpoint-box {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(139, 92, 246, 0.08));
    border: 2px solid var(--color-primary);
    border-radius: 12px;
    padding: 1.75rem;
    margin: 0;
    display: flex;
    gap: 1.25rem;
    align-items: flex-start;
}

.checkpoint-icon {
    width: 40px;
    height: 40px;
    background: var(--color-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: bold;
    flex-shrink: 0;
}

.checkpoint-content {
    flex: 1;
}

.checkpoint-content h3 {
    color: var(--color-primary);
    margin: 0 0 0.75rem 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.checkpoint-content p {
    margin: 0;
    line-height: 1.6;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        display: none;
    }
    
    .page-header {
        padding: 1rem;
        flex-wrap: wrap;
    }
    
    .search-bar {
        order: 3;
        width: 100%;
        max-width: 100%;
        margin-top: 0.75rem;
    }
    
    .content-wrapper {
        padding: 2rem 1rem;
    }
    
    .week-title {
        font-size: 1.75rem;
    }
    
    .week-meta-grid {
        grid-template-columns: 1fr;
    }
    
    .lesson-card {
        border-radius: 8px;
    }
    
    .lesson-header {
        flex-direction: column;
        padding: 1.25rem;
        gap: 1rem;
    }
    
    .day-title {
        font-size: 1.25rem;
    }
    
    .lesson-section {
        padding: 1.25rem;
    }
    
    .lesson-section h3 {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .time-badge {
        margin-left: 0;
    }
    
    .vocab-grid {
        gap: 0.4rem;
    }
    
    .checkpoint-box {
        flex-direction: column;
        padding: 1.25rem;
        gap: 1rem;
    }
    
    .cover-details {
        gap: 2rem;
    }
    
    .detail-number {
        font-size: 2rem;
    }
    
    .stages-grid {
        grid-template-columns: 1fr;
    }
}
