html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    overflow-x: hidden;
    max-width: 100vw;
}

* {
    max-width: 100%;
}

img {
    max-width: 100% !important;
    height: auto !important;
}

.prose :where(h1, h2, h3, h4) {
    scroll-margin-top: 6rem
}

/* Fixed TOC sidebar */
aside.toc-sidebar {
    position: fixed;
    top: 6rem;
    width: 280px;
    max-height: calc(100vh - 8rem);
    overflow-y: auto;
}

@media (min-width: 1600px) {
    aside.toc-sidebar {
        left: calc((100vw - 1600px) / 2 + 2rem);
        width: 320px;
    }

    .content-with-toc {
        max-width: 1600px;
        margin: 0 auto;
        padding-left: 380px;
        padding-right: 2rem;
    }

    .content-with-toc article {
        max-width: 1200px;
    }
}

@media (min-width: 1280px) and (max-width: 1599px) {
    aside.toc-sidebar {
        left: 2rem;
        width: 300px;
    }

    .content-with-toc {
        margin-left: 0;
        margin-right: 0;
        padding-left: 340px;
        padding-right: 2rem;
    }

    .content-with-toc article {
        max-width: 1100px;
        margin: 0 auto;
    }
}

@media (min-width: 1024px) and (max-width: 1279px) {
    aside.toc-sidebar {
        left: 1.5rem;
    }

    .content-with-toc {
        margin-left: 0;
        margin-right: 0;
        padding-left: 310px;
        padding-right: 1.5rem;
    }

    .content-with-toc article {
        max-width: 100%;
    }
}

@media (max-width: 1023px) {
    aside.toc-sidebar {
        display: none !important;
    }

    .content-with-toc {
        margin-left: auto;
        margin-right: auto;
        padding-left: 1rem;
        padding-right: 1rem;
        max-width: 100%;
    }
}

.docx-clean * {
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Noto Sans, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji"
}

/* Enhanced heading styles */
article h1 {
    font-size: 3rem;
    font-weight: 900;
    color: #7c3aed;
    margin-bottom: 2rem;
    margin-top: 4rem;
    padding-bottom: 1rem;
    padding-left: 1.5rem;
    border-left: 10px solid #ec4899;
    line-height: 1.2;
}

article h2 {
    font-size: 2.25rem;
    font-weight: 800;
    color: #2563eb;
    margin-bottom: 1.5rem;
    margin-top: 3rem;
    padding-left: 1rem;
    border-left: 8px solid #8b5cf6;
    line-height: 1.3;
}

article h3 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #ec4899;
    margin-bottom: 1.25rem;
    margin-top: 2.5rem;
    line-height: 1.4;
}

/* Enhanced paragraph and text styles */
.docx-clean p {
    font-size: 1.125rem;
    line-height: 1.75;
    color: #1f2937;
    margin: 1rem 0;
    font-weight: 500;
}

.docx-clean strong {
    font-weight: 800;
    color: #be185d;
}

.docx-clean ul {
    list-style: disc;
    list-style-position: inside;
    padding-left: 1.25rem;
    margin-bottom: 1.5rem;
}

.docx-clean ul li {
    font-size: 1.125rem;
    color: #374151;
    line-height: 1.75;
    margin-top: 0.5rem;
}

.docx-clean ul li::marker {
    color: #ec4899;
}

.docx-clean ol {
    list-style: decimal;
    list-style-position: inside;
    padding-left: 1.25rem;
    margin-bottom: 1.5rem;
}

.docx-clean ol li {
    font-size: 1.125rem;
    color: #374151;
    line-height: 1.75;
    margin-top: 0.5rem;
}

.docx-clean a {
    color: #2563eb;
    font-weight: 600;
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 2px;
    transition: color 0.2s;
}

.docx-clean a:hover {
    color: #7c3aed;
}

.docx-clean img {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    margin: 1.5rem 0;
}

.docx-clean table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 2rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    border-radius: 0.5rem;
    overflow: hidden;
}

.docx-clean th {
    background: linear-gradient(to right, #ec4899, #a855f7);
    color: white;
    font-weight: 700;
    padding: 1.5rem;
    text-align: left;
    font-size: 1.125rem;
}

.docx-clean td {
    padding: 1.5rem;
    border-bottom: 1px solid #fbcfe8;
    color: #1f2937;
    font-size: 1.125rem;
}

.docx-clean tr:hover {
    background-color: #fdf2f8;
}

.docx-clean .title {
    font-size: 3rem;
    font-weight: 800;
    background: linear-gradient(to right, #ec4899, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 2rem;
}

/* Music Controls */
.music-controls {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 20;
    background: linear-gradient(135deg, #ec4899, #8b5cf6);
    padding: 15px 20px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(236, 72, 153, 0.4);
    display: flex;
    align-items: center;
    gap: 15px;
    animation: fade-in 0.5s ease-in;
}

.music-btn {
    background: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    color: #ec4899;
    font-size: 18px;
    font-weight: bold;
}

.music-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

.volume-slider {
    width: 100px;
    height: 6px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.3);
    outline: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.volume-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.volume-icon {
    color: white;
    font-size: 20px;
}

@media (max-width: 1023px) {
    .music-controls {
        top: 70px;
        left: 10px;
        right: auto;
        padding: 8px 12px;
        gap: 8px;
        flex-direction: row;
    }

    .music-btn {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }

    .volume-control {
        flex-direction: row;
        gap: 8px;
    }

    .volume-slider {
        width: 80px;
    }

    .volume-icon {
        font-size: 16px;
    }
}

/* Checkbox styles */
.checklist-item {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
}

.custom-checkbox {
    appearance: none;
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid #ec4899;
    border-radius: 0.25rem;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
    flex-shrink: 0;
}

.custom-checkbox:hover {
    border-color: #be185d;
    box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.1);
}

.custom-checkbox:checked {
    background: linear-gradient(135deg, #ec4899, #8b5cf6);
    border-color: #ec4899;
}

.custom-checkbox:checked::after {
    content: '✓';
    position: absolute;
    color: white;
    font-size: 0.875rem;
    font-weight: bold;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}