/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #0366d6;
    --secondary-color: #28a745;
    --danger-color: #d73a49;
    --warning-color: #ffd33d;
    --dark-color: #24292e;
    --light-color: #f6f8fa;
    --text-color: #24292e;
    --text-light: #586069;
    --border-color: #e1e4e8;
    --shadow: 0 1px 3px rgba(27,31,35,.12), 0 8px 24px rgba(66,74,83,.12);
    --shadow-sm: 0 1px 0 rgba(27,31,35,.04);
    --radius: 6px;
    --font-main: 'Inter', 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-code: 'Monaco', 'Consolas', monospace;
}

body {
    font-family: var(--font-main);
    line-height: 1.6;
    color: var(--text-color);
    background-color: #ffffff;
    font-size: 16px;
}

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

/* Header Styles */
.main-header {
    background-color: var(--dark-color);
    color: white;
    padding: 2rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
}

.site-title {
    font-size: 2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.site-title i {
    font-size: 2.5rem;
}

.site-subtitle {
    font-size: 1.1rem;
    font-weight: 300;
    opacity: 0.9;
}

/* Progress Navigation */
.progress-nav {
    background-color: var(--light-color);
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 108px;
    z-index: 999;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background-color: #dfe2e5;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.9rem;
    color: var(--text-light);
    text-align: center;
}

/* Hero Section */
.hero-section {
    padding: 4rem 0;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    line-height: 1.3;
}

.hero-description {
    font-size: 1.2rem;
    color: var(--text-light);
    max-width: 800px;
    margin: 0 auto 3rem;
    line-height: 1.8;
}

.hero-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.feature-card {
    background: var(--light-color);
    padding: 2rem;
    border-radius: var(--radius);
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
}

.feature-card i {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.feature-card h3 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
}

.feature-card p {
    color: var(--text-light);
}

/* Chapters Overview */
.chapters-overview {
    padding: 4rem 0;
}

.section-title {
    font-size: 2rem;
    text-align: center;
    margin-bottom: 3rem;
    position: relative;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: var(--primary-color);
}

.chapters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
}

.chapter-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 2rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

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

.chapter-card.advanced {
    border-color: var(--secondary-color);
}

.chapter-card.advanced .chapter-number {
    background: var(--secondary-color);
}

.chapter-header {
    margin-bottom: 1rem;
}

.chapter-number {
    display: inline-block;
    background: var(--primary-color);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.chapter-title {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.chapter-description {
    color: var(--text-light);
    margin-bottom: 1rem;
}

.chapter-topics {
    list-style: none;
    margin-bottom: 1.5rem;
}

.chapter-topics li {
    padding-left: 1.5rem;
    position: relative;
    margin-bottom: 0.5rem;
    color: var(--text-light);
}

.chapter-topics li::before {
    content: '▸';
    position: absolute;
    left: 0;
    color: var(--primary-color);
}

.chapter-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: gap 0.2s ease;
}

.chapter-link:hover {
    gap: 0.8rem;
}

/* Learning Path */
.learning-path {
    padding: 4rem 0;
    background: var(--light-color);
}

.path-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.path-item {
    text-align: center;
    max-width: 250px;
}

.path-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1rem;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
}

.path-icon i {
    font-size: 2.5rem;
    color: var(--primary-color);
}

.path-item h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.path-item p {
    color: var(--text-light);
    font-size: 0.95rem;
}

.path-arrow {
    font-size: 2rem;
    color: var(--text-light);
}

/* Prerequisites */
.prerequisites {
    padding: 4rem 0;
}

.prereq-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.prereq-item {
    text-align: center;
    padding: 2rem;
}

.prereq-item i {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
    display: block;
}

.prereq-item h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.prereq-item p {
    color: var(--text-light);
}

/* CTA Section */
.cta-section {
    padding: 4rem 0;
    text-align: center;
    background: var(--light-color);
    border-radius: var(--radius);
    margin: 4rem 0;
}

.cta-section h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.cta-section p {
    font-size: 1.1rem;
    color: var(--text-light);
    margin-bottom: 2rem;
}

.cta-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--primary-color);
    color: white;
    padding: 1rem 2rem;
    border-radius: var(--radius);
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
    transition: all 0.2s ease;
}

.cta-button:hover {
    background: #0256c7;
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

/* Footer */
.main-footer {
    background: var(--dark-color);
    color: white;
    padding: 2rem 0;
    text-align: center;
    margin-top: 4rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-description {
        font-size: 1.1rem;
    }
    
    .chapters-grid {
        grid-template-columns: 1fr;
    }
    
    .path-container {
        flex-direction: column;
    }
    
    .path-arrow {
        transform: rotate(90deg);
    }
}

/* Chapter Page Styles */
.chapter-header-main {
    background: linear-gradient(135deg, var(--dark-color), #444d56);
    color: white;
    padding: 3rem 0;
    margin-bottom: 3rem;
}

.chapter-header-main h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.chapter-meta {
    display: flex;
    gap: 2rem;
    font-size: 0.95rem;
    opacity: 0.9;
}

.chapter-content {
    max-width: 900px;
    margin: 0 auto;
}

.content-section {
    margin-bottom: 3rem;
}

.content-section h2 {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

.content-section h3 {
    font-size: 1.4rem;
    margin: 2rem 0 1rem;
    color: var(--primary-color);
}

/* Code Blocks */
.code-block {
    background: var(--dark-color);
    color: #f8f8f2;
    padding: 1.5rem;
    border-radius: var(--radius);
    overflow-x: auto;
    margin: 1.5rem 0;
    position: relative;
}

.code-block pre {
    margin: 0;
    overflow-x: auto;
}

.code-block pre code {
    display: block;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
    line-height: 1.6;
    white-space: pre;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #444;
}

.code-language {
    font-size: 0.9rem;
    color: var(--secondary-color);
    font-weight: 600;
}

.copy-button {
    background: transparent;
    border: 1px solid #444;
    color: #fff;
    padding: 0.3rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.copy-button:hover {
    background: #444;
}

.copy-button.copied {
    background: var(--secondary-color);
    border-color: var(--secondary-color);
}

/* Exercise Blocks */
.exercise-block {
    background: #f0f7ff;
    border-left: 4px solid var(--primary-color);
    padding: 1.5rem;
    margin: 2rem 0;
    border-radius: var(--radius);
}

.exercise-block h4 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.exercise-block h4 i {
    font-size: 1.5rem;
}

/* Info Boxes */
.info-box {
    padding: 1.5rem;
    margin: 2rem 0;
    border-radius: var(--radius);
    border-left: 4px solid;
}

.info-box.tip {
    background: #f0f9ff;
    border-color: var(--primary-color);
}

.info-box.warning {
    background: #fffbeb;
    border-color: var(--warning-color);
}

.info-box.important {
    background: #fef2f2;
    border-color: var(--danger-color);
}

.info-box-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

/* Navigation */
.chapter-nav {
    display: flex;
    justify-content: space-between;
    margin: 4rem 0;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.nav-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    background: var(--light-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text-color);
    transition: all 0.2s ease;
}

.nav-button:hover {
    background: white;
    box-shadow: var(--shadow-sm);
    transform: translateY(-2px);
}

.nav-button.prev i {
    order: -1;
}

.nav-button.next {
    margin-left: auto;
}

/* Interactive Elements */
.interactive-demo {
    background: var(--light-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 2rem;
    margin: 2rem 0;
}

.demo-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.demo-button {
    padding: 0.5rem 1rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.demo-button:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.demo-output {
    background: white;
    padding: 1rem;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    font-family: var(--font-code);
    white-space: pre-wrap;
}