body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans KR", Helvetica, Arial, sans-serif;
    margin: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #1d1d1f;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
}

.container {
    display: flex;
}

header {
    background: linear-gradient(135deg, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0.9) 100%);
    backdrop-filter: blur(10px);
    color: #1d1d1f;
    padding: 2.5rem 1rem;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.3);
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

header h1 {
    font-size: 2.5rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
}

header p {
    font-size: 1.1rem;
    color: #6e6e73;
    margin-bottom: 1.5rem;
}

.header-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.header-buttons {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
}

header input {
    width: 100%;
    max-width: 400px;
    padding: 0.75rem 1rem;
    border: 1px solid #ddd;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: rgba(255,255,255,0.9);
}

header input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
}

.theme-btn, .reset-btn, .export-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.theme-btn {
    background: #2d3748;
    color: white;
}

.reset-btn {
    background: #ff4757;
    color: white;
}

.export-btn {
    background: #667eea;
    color: white;
}

.theme-btn:hover, .reset-btn:hover, .export-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

nav {
    width: 280px;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    padding: 1.5rem;
    height: 100vh;
    overflow-y: auto;
    border-right: 1px solid rgba(255,255,255,0.3);
    box-shadow: 2px 0 15px rgba(0,0,0,0.1);
}

nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

nav ul li {
    padding: 1rem;
    cursor: pointer;
    border-radius: 12px;
    margin-bottom: 0.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    border: 2px solid transparent;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

nav ul li .topic-title {
    flex-grow: 1;
}

nav ul li .progress-indicator {
    font-size: 1.2rem;
    margin-left: 0.5rem;
    font-weight: bold;
}

nav ul li:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    transform: translateX(8px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

nav ul li.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: rgba(255,255,255,0.3);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

main {
    flex-grow: 1;
    padding: 2rem 4rem;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    margin: 1rem;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
}

.content-item {
    display: none;
}

.content-item.active {
    display: block;
    animation: fadeIn 0.5s ease-in-out;
}

.title-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #d2d2d7;
    padding-bottom: 1.5rem;
    margin-bottom: 2.5rem;
}

.content-item h2 {
    font-size: 2.8rem;
    font-weight: 700;
    color: #1d1d1f;
    margin: 0;
    letter-spacing: -0.5px;
}

.expand-all-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.expand-all-btn:hover {
    background: #5a6fd8;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.accordion-item {
    border: 1px solid #e5e5e5;
    border-radius: 16px;
    margin-bottom: 1.25rem;
    background-color: #fff;
    overflow: hidden;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.accordion-item:hover {
    border-color: #c7c7c7;
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.06);
}

.accordion-item.active {
    border-color: #667eea;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.2);
}

.accordion-header {
    padding: 1.5rem 2rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.3rem;
    font-weight: 600;
    color: #1d1d1f;
    transition: background-color 0.2s ease;
}

.accordion-item.active .accordion-header {
    color: #667eea;
}

.accordion-header::after {
    content: '+';
    font-size: 2.5rem;
    font-weight: 200;
    color: #667eea;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    line-height: 1;
}

.accordion-item.active .accordion-header::after {
    transform: rotate(45deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1), padding 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem; /* Spacing between content parts */
}

.accordion-item.active .accordion-content {
    padding-top: 1rem;
    padding-bottom: 2rem;
}

.content-part {
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid;
    line-height: 1.7;
}

.content-part strong {
    display: block;
    margin-bottom: 0.75rem;
    font-weight: 600;
    font-size: 1.1rem;
    color: #1d1d1f;
}

.content-part p {
    margin: 0;
    color: #333;
}

.content-part.definition {
    background: linear-gradient(135deg, #f0f7ff 0%, #e6f2ff 100%);
    border-color: #667eea;
}

.content-part.code {
    background-color: #f5f5f5;
    border-color: #e0e0e0;
    padding: 0;
}

.content-part.code strong {
    padding: 1.5rem 1.5rem 0 1.5rem;
}

.content-part.description {
    background: linear-gradient(135deg, #f0fff4 0%, #e6fae6 100%);
    border-color: #52c41a;
}

.content-part.tip {
    background: linear-gradient(135deg, #fffaf0 0%, #fff7e6 100%);
    border-color: #fa8c16;
}

pre {
    background-color: #2d2d2d !important;
    color: #f8f8f2;
    padding: 1.5rem;
    border-radius: 0 0 11px 11px;
    white-space: pre-wrap;
    word-wrap: break-word;
    margin: 0;
    margin-top: 1.25rem;
}

code {
    font-family: "SF Mono", "Fira Code", "Courier New", Courier, monospace;
    font-size: 0.95rem;
}

mark {
    background-color: #ffeb3b;
    color: #333;
    padding: 2px 4px;
    border-radius: 3px;
}

.code-actions {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.copy-btn, .run-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.copy-btn:hover, .run-btn:hover {
    background: #5a6fd8;
    transform: translateY(-2px);
}

.code-explanation {
    margin-top: 1rem;
    padding: 1rem;
    background: linear-gradient(135deg, #f8f9ff 0%, #e6f2ff 100%);
    border-left: 4px solid #667eea;
    border-radius: 6px;
}

.explanation-content h4 {
    margin: 0 0 0.5rem 0;
    color: #667eea;
}

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

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }

    nav {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid #ddd;
    }

    main {
        padding: 1.5rem;
    }

    .title-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .content-item h2 {
        font-size: 2rem;
    }
    
    .expand-all-btn {
        align-self: stretch;
        text-align: center;
    }

    .accordion-header {
        font-size: 1.1rem;
        padding: 1.25rem 1.5rem;
    }
    
    .header-controls {
        flex-direction: column;
    }
    
    .header-buttons {
        flex-direction: column;
        width: 100%;
        max-width: 300px;
    }
}

/* Dark mode styles */
body.dark-mode {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #e2e8f0;
}

body.dark-mode header {
    background: linear-gradient(135deg, rgba(26,26,46,0.95) 0%, rgba(22,33,62,0.9) 100%);
    color: #e2e8f0;
}

body.dark-mode nav {
    background: rgba(26,26,46,0.95);
}

body.dark-mode main {
    background: rgba(26,26,46,0.95);
    color: #e2e8f0;
}

body.dark-mode .accordion-item {
    background-color: rgba(45,55,72,0.8);
    border-color: #4a5568;
}

body.dark-mode .accordion-item:hover {
    border-color: #667eea;
}

body.dark-mode .accordion-header {
    color: #e2e8f0;
}

body.dark-mode .content-part {
    background: rgba(45,55,72,0.6);
    border-color: #4a5568;
    color: #e2e8f0;
}

body.dark-mode .content-part.definition {
    background: linear-gradient(135deg, rgba(102,126,234,0.2) 0%, rgba(102,126,234,0.1) 100%);
    border-color: #667eea;
}

body.dark-mode .content-part.description {
    background: linear-gradient(135deg, rgba(82,196,26,0.2) 0%, rgba(82,196,26,0.1) 100%);
    border-color: #52c41a;
}

body.dark-mode .content-part.tip {
    background: linear-gradient(135deg, rgba(250,140,22,0.2) 0%, rgba(250,140,22,0.1) 100%);
    border-color: #fa8c16;
}

body.dark-mode header input {
    background: rgba(45,55,72,0.8);
    border-color: #4a5568;
    color: #e2e8f0;
}

body.dark-mode header input::placeholder {
    color: #a0aec0;
}

body.dark-mode .content-item h2 {
    color: #e2e8f0;
}

body.dark-mode .title-container {
    border-color: #4a5568;
}

footer {
    background: linear-gradient(135deg, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0.9) 100%);
    backdrop-filter: blur(10px);
    text-align: center;
    padding: 1.5rem;
    margin-top: 2rem;
    border-top: 1px solid rgba(255,255,255,0.3);
    color: #6e6e73;
    font-size: 0.9rem;
}

footer p {
    margin: 0;
}

body.dark-mode footer {
    background: linear-gradient(135deg, rgba(26,26,46,0.95) 0%, rgba(22,33,62,0.9) 100%);
    color: #a0aec0;
    border-color: #4a5568;
}
