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

html {
    scroll-behavior: smooth;
    scroll-padding-top: 100px; /* Account for fixed navbar height */
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.6;
    color: #e5e7eb;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    -webkit-tap-highlight-color: rgba(236, 72, 153, 0.2);
}

/* Navigation */
.navbar {
    background: linear-gradient(135deg, #ec4899 0%, #8b5cf6 50%, #3b82f6 100%);
    color: white;
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(236, 72, 153, 0.3);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand h1 {
    font-size: 1.5rem;
    font-weight: 700;
    display: inline-block;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.nav-brand .version {
    background: rgba(255,255,255,0.2);
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    margin-left: 0.5rem;
    backdrop-filter: blur(10px);
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-links a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
    padding: 0.5rem 1rem;
    border-radius: 8px;
}

.nav-links a:hover {
    background: rgba(255,255,255,0.1);
    transform: translateY(-2px);
}

/* Main Layout */
.container {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 3rem;
    padding: 2rem;
    min-height: calc(100vh - 80px);
    /* Ensure container doesn't interfere with sticky positioning */
    position: relative;
}

/* Sidebar */
.sidebar {
    background: rgba(30, 30, 60, 0.8);
    border-radius: 16px;
    padding: 1.5rem;
    height: fit-content;
    position: -webkit-sticky; /* Safari/Chrome prefix */
    position: sticky;
    top: 120px; /* Increased space for navbar */
    box-shadow: 0 8px 32px rgba(236, 72, 153, 0.1);
    border: 1px solid rgba(236, 72, 153, 0.2);
    backdrop-filter: blur(20px);
    max-height: calc(100vh - 140px); /* Prevent sidebar from getting too tall */
    overflow-y: auto; /* Allow scrolling if content is too long */
    z-index: 10; /* Ensure sidebar stays on top */
    align-self: start; /* Important for CSS Grid sticky positioning */
}

.sidebar-section {
    margin-bottom: 2rem;
}

.sidebar-section h3 {
    color: #f472b6;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.sidebar-section ul {
    list-style: none;
}

.sidebar-section li {
    margin-bottom: 0.25rem;
}

.sidebar-section a {
    display: block;
    color: #d1d5db;
    text-decoration: none;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.sidebar-section a:hover {
    background: rgba(236, 72, 153, 0.1);
    color: #f472b6;
    transform: translateX(4px);
}

/* Main Content */
.main-content {
    background: rgba(30, 30, 60, 0.8);
    border-radius: 16px;
    padding: 3rem;
    box-shadow: 0 8px 32px rgba(236, 72, 153, 0.1);
    border: 1px solid rgba(236, 72, 153, 0.2);
    backdrop-filter: blur(20px);
}

.doc-section {
    margin-bottom: 4rem;
}

.doc-section h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #ec4899 0%, #8b5cf6 50%, #3b82f6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.doc-section h2 {
    font-size: 2rem;
    font-weight: 600;
    color: #f472b6;
    margin-bottom: 1rem;
    margin-top: 2rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid rgba(236, 72, 153, 0.3);
}

.doc-section h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #e879f9;
    margin-bottom: 0.75rem;
    margin-top: 1.5rem;
}

.doc-section h4 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #e879f9;
    margin-bottom: 0.5rem;
}

.doc-section p {
    margin-bottom: 1rem;
    color: #d1d5db;
}

.intro-text {
    font-size: 1.125rem;
    line-height: 1.7;
    color: #d1d5db;
    margin-bottom: 2rem;
}

/* Code Blocks */
pre {
    background: linear-gradient(135deg, #1e1e2e 0%, #2d1b69 100%);
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1rem 0;
    overflow-x: auto;
    border: 1px solid rgba(139, 92, 246, 0.3);
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.1);
}

code {
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 0.875rem;
}

p code, li code, td code {
    background: rgba(139, 92, 246, 0.2);
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    color: #c084fc;
    font-size: 0.875rem;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

/* Info Boxes */
.info-box, .tip-box, .warning-box, .support-box, .example-box {
    padding: 1.5rem;
    border-radius: 12px;
    margin: 1.5rem 0;
    border-left: 4px solid;
    backdrop-filter: blur(10px);
}

.info-box {
    background: rgba(59, 130, 246, 0.1);
    border-left-color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.tip-box {
    background: rgba(236, 72, 153, 0.1);
    border-left-color: #ec4899;
    border: 1px solid rgba(236, 72, 153, 0.2);
}

.warning-box {
    background: rgba(245, 158, 11, 0.1);
    border-left-color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.support-box {
    background: rgba(236, 72, 153, 0.1);
    border-left-color: #ec4899;
    border: 1px solid rgba(236, 72, 153, 0.2);
}

.example-box {
    background: rgba(139, 92, 246, 0.1);
    border-left-color: #8b5cf6;
    border: 1px solid rgba(139, 92, 246, 0.2);
}

/* Resource Links */
.resource-links {
    margin: 2rem 0;
}

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

.resource-link {
    display: block;
    padding: 1.5rem;
    background: rgba(30, 30, 60, 0.6);
    border: 2px solid rgba(236, 72, 153, 0.3);
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s;
    backdrop-filter: blur(10px);
}

.resource-link:hover {
    border-color: #ec4899;
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(236, 72, 153, 0.2);
    background: rgba(236, 72, 153, 0.1);
}

.resource-link strong {
    display: block;
    color: #f472b6;
    margin-bottom: 0.5rem;
}

.resource-link span {
    color: #d1d5db;
    font-size: 0.875rem;
}

/* Step List */
.step-list {
    margin: 2rem 0;
}

.step {
    display: flex;
    align-items: flex-start;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid rgba(236, 72, 153, 0.2);
}

.step:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.step-number {
    background: linear-gradient(135deg, #ec4899 0%, #8b5cf6 100%);
    color: white;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    margin-right: 1.5rem;
    flex-shrink: 0;
    box-shadow: 0 4px 15px rgba(236, 72, 153, 0.3);
}

.step-content h3, .step-content h4 {
    margin-top: 0;
}

/* Tables */
.parameter-table {
    margin: 2rem 0;
    overflow-x: auto;
}

.parameter-table table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(30, 30, 60, 0.6);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(236, 72, 153, 0.1);
    border: 1px solid rgba(236, 72, 153, 0.2);
}

.parameter-table th,
.parameter-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(236, 72, 153, 0.1);
}

.parameter-table th {
    background: rgba(236, 72, 153, 0.1);
    font-weight: 600;
    color: #f472b6;
}

.parameter-table td {
    color: #d1d5db;
}

.parameter-table tr:last-child td {
    border-bottom: none;
}

/* Concept Grid - Fixed for better readability */
.concept-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin: 2rem 0;
}

.concept-card {
    background: rgba(30, 30, 60, 0.6);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid rgba(139, 92, 246, 0.2);
    backdrop-filter: blur(10px);
}

.concept-card h3 {
    color: #c084fc;
    margin-bottom: 0.5rem;
    margin-top: 0;
}

.concept-card p {
    color: #d1d5db;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

/* Choice Types */
.choice-types {
    margin: 2rem 0;
}

.choice-type {
    background: rgba(30, 30, 60, 0.6);
    border: 1px solid rgba(236, 72, 153, 0.2);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    backdrop-filter: blur(10px);
}

.choice-type h3 {
    margin-top: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Flag Operations - Fixed layout */
.flag-operations {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin: 2rem 0;
}

.flag-op {
    background: rgba(30, 30, 60, 0.6);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid rgba(139, 92, 246, 0.2);
    backdrop-filter: blur(10px);
}

.flag-op h3 {
    margin-top: 0;
    color: #c084fc;
}

/* Special Message Grid - Fixed layout */
.special-message-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin: 2rem 0;
}

.special-msg {
    background: rgba(30, 30, 60, 0.6);
    border: 1px solid rgba(236, 72, 153, 0.2);
    border-radius: 12px;
    padding: 1.5rem;
    backdrop-filter: blur(10px);
}

.special-msg h3 {
    margin-top: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Image Specs */
.image-specs {
    margin: 2rem 0;
}

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

.spec-card {
    background: rgba(30, 30, 60, 0.6);
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
    border: 1px solid rgba(139, 92, 246, 0.2);
    backdrop-filter: blur(10px);
}

.spec-card h4 {
    margin-top: 0;
    color: #c084fc;
}

.spec-card p {
    margin-bottom: 0.5rem;
}

/* Time Examples */
.time-examples {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.time-example {
    background: rgba(30, 30, 60, 0.6);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid rgba(139, 92, 246, 0.2);
    backdrop-filter: blur(10px);
}

.time-example h3 {
    margin-top: 0;
    color: #c084fc;
}

.day-values {
    background: rgba(59, 130, 246, 0.1);
    padding: 1rem;
    border-radius: 12px;
    margin: 1rem 0;
    border-left: 4px solid #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

/* Testing Checklist */
.testing-checklist {
    margin: 2rem 0;
}

.checklist {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
}

.checkbox-item {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 0.75rem;
    background: rgba(30, 30, 60, 0.6);
    border-radius: 8px;
    transition: all 0.2s;
    border: 1px solid rgba(236, 72, 153, 0.2);
}

.checkbox-item:hover {
    background: rgba(236, 72, 153, 0.1);
    border-color: #ec4899;
}

.checkbox-item input[type="checkbox"] {
    margin-right: 0.75rem;
    width: 1.25rem;
    height: 1.25rem;
    accent-color: #ec4899;
}

/* File Examples */
.file-example {
    margin: 2rem 0;
}

.file-example h3 {
    background: linear-gradient(135deg, #374151 0%, #4c1d95 100%);
    color: white;
    padding: 0.75rem 1rem;
    margin: 0;
    border-radius: 12px 12px 0 0;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.file-example pre {
    margin-top: 0;
    border-radius: 0 0 12px 12px;
}

/* GIF Container */
.gif-container {
    text-align: center;
    margin: 2rem 0;
    padding: 2rem;
    background: rgba(30, 30, 60, 0.6);
    border-radius: 12px;
    border: 1px solid rgba(236, 72, 153, 0.2);
}

.gif-placeholder {
    background: rgba(139, 92, 246, 0.1);
    border: 2px dashed rgba(139, 92, 246, 0.3);
    border-radius: 8px;
    padding: 3rem;
    color: #c084fc;
    font-style: italic;
}

/* Footer */
.doc-footer {
    margin-top: 4rem;
    padding: 2rem 0;
    border-top: 1px solid rgba(236, 72, 153, 0.2);
    text-align: center;
    color: #d1d5db;
}

.doc-footer p {
    margin-bottom: 0.5rem;
}

.version-info {
    font-size: 0.875rem;
    opacity: 0.8;
}

/* Lists */
ul, ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

li {
    margin-bottom: 0.5rem;
    color: #d1d5db;
}

/* Prevent horizontal overflow */
* {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

body {
    overflow-x: hidden;
    overflow-y: auto; /* Explicitly allow vertical scrolling */
}

.container {
    /* Removed overflow-x: hidden to allow sticky positioning */
}

.main-content {
    overflow-x: hidden;
}

/* Sidebar overflow handled in main rule */

/* Mobile menu toggle - hidden on desktop */
.mobile-menu-toggle {
    display: none;
}

/* Touch interaction improvements */
button, input, select, textarea {
    touch-action: manipulation;
}

/* Prevent zoom on input focus on iOS */
input, textarea {
    font-size: 16px;
}

/* Smooth scrolling for mobile */
@media (max-width: 768px) {
    html {
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
    }
    
    input, textarea {
        font-size: 16px; /* Prevent zoom on iOS */
    }
}

/* Desktop styles */
@media (min-width: 901px) {
    .sidebar {
        position: -webkit-sticky;
        position: sticky;
        top: 120px;
        align-self: start;
    }
    
    /* Hide mobile menu toggle on desktop */
    .mobile-menu-toggle {
        display: none !important;
    }
}

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

@media (max-width: 900px) {
    .container {
        grid-template-columns: 1fr;
        gap: 2rem;
        max-width: 800px;
    }
    
    .sidebar {
        position: static; /* Remove sticky on smaller screens */
        top: auto;
        max-height: none;
        overflow-y: visible;
        order: 2;
    }
    
    .main-content {
        order: 1;
    }
}

@media (max-width: 768px) {
    /* Prevent horizontal overflow on mobile */
    html, body {
        overflow-x: hidden;
        max-width: 100vw;
    }
    
    .container {
        max-width: 100vw;
        overflow-x: hidden; /* Keep this on mobile since no sticky positioning here */
        flex-direction: column;
        gap: 0;
    }
    
    .main-content, .sidebar {
        max-width: 100%;
        overflow-x: hidden;
    }
    
    /* Navigation */
    .navbar {
        padding: 0.75rem 0;
        overflow-x: hidden;
    }
    
    .nav-container {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
        padding: 0 1rem;
        max-width: 100%;
    }
    
    .nav-brand h1 {
        font-size: 1.25rem;
        word-break: break-word;
    }
    
    .nav-brand .version {
        font-size: 0.7rem;
        padding: 0.2rem 0.4rem;
    }
    
    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.75rem;
        max-width: 100%;
    }
    
    .nav-links a {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
    
    /* Mobile menu toggle */
    .mobile-menu-toggle {
        display: block;
        background: rgba(236, 72, 153, 0.2);
        border: 1px solid rgba(236, 72, 153, 0.3);
        border-radius: 12px;
        padding: 1rem;
        margin: 1rem;
        cursor: pointer;
        transition: all 0.3s ease;
        color: #f472b6;
        font-weight: 600;
        text-align: center;
        backdrop-filter: blur(10px);
    }
    
    .mobile-menu-toggle:hover {
        background: rgba(236, 72, 153, 0.3);
        border-color: rgba(236, 72, 153, 0.5);
    }
    
    .mobile-menu-toggle::after {
        content: " ▼";
        font-size: 0.8rem;
        margin-left: 0.5rem;
        transition: transform 0.3s ease;
    }
    
    .mobile-menu-toggle.active::after {
        transform: rotate(180deg);
    }
    
    /* Layout */
    .container {
        padding: 0;
        gap: 0;
        width: 100%;
        box-sizing: border-box;
    }
    
    .sidebar {
        order: -1;
        border-radius: 0;
        padding: 0;
        width: 100%;
        box-sizing: border-box;
        background: transparent;
        backdrop-filter: none;
        margin: 0;
        max-height: 0;
        overflow: hidden;
        transition: all 0.3s ease;
    }
    
    .sidebar.mobile-open {
        max-height: 100vh;
        background: rgba(30, 30, 60, 0.95);
        backdrop-filter: blur(10px);
        border-bottom: 1px solid rgba(236, 72, 153, 0.2);
    }
    
    .sidebar-content {
        padding: 1rem;
        opacity: 0;
        transition: opacity 0.3s ease 0.1s;
    }
    
    .sidebar.mobile-open .sidebar-content {
        opacity: 1;
    }
    
    .sidebar-section {
        margin-bottom: 1.5rem;
    }
    
    .sidebar-section h3 {
        font-size: 0.9rem;
        word-break: break-word;
        color: #f472b6;
        margin-bottom: 0.75rem;
    }
    
    .sidebar-section ul {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 0.5rem;
    }
    
    .sidebar-section a {
        padding: 0.6rem 0.8rem;
        font-size: 0.8rem;
        word-break: break-word;
        border-radius: 8px;
        background: rgba(59, 130, 246, 0.1);
        border: 1px solid rgba(59, 130, 246, 0.2);
        text-align: center;
        transition: all 0.2s ease;
    }
    
    .sidebar-section a:hover,
    .sidebar-section a.active {
        background: rgba(236, 72, 153, 0.2) !important;
        border-color: rgba(236, 72, 153, 0.4) !important;
        color: #f472b6 !important;
        transform: translateY(-1px);
    }
    
    .main-content {
        padding: 1.5rem;
        border-radius: 0;
        width: 100%;
        box-sizing: border-box;
        margin: 0;
    }
    
    /* Typography */
    .doc-section {
        width: 100%;
        overflow-x: hidden;
    }
    
    .doc-section h1 {
        font-size: 1.75rem;
        margin-bottom: 1rem;
        word-break: break-word;
        hyphens: auto;
    }
    
    .doc-section h2 {
        font-size: 1.5rem;
        margin-bottom: 0.75rem;
        margin-top: 1.5rem;
        word-break: break-word;
        hyphens: auto;
    }
    
    .doc-section h3 {
        font-size: 1.125rem;
        margin-bottom: 0.5rem;
        margin-top: 1rem;
        word-break: break-word;
        hyphens: auto;
    }
    
    .doc-section h4 {
        font-size: 1rem;
        margin-bottom: 0.5rem;
        word-break: break-word;
        hyphens: auto;
    }
    
    .doc-section p {
        word-break: break-word;
        hyphens: auto;
        overflow-wrap: break-word;
    }
    
    .intro-text {
        font-size: 1rem;
        line-height: 1.6;
        word-break: break-word;
        hyphens: auto;
    }
    
    /* Code blocks */
    pre {
        padding: 1rem;
        margin: 0.75rem 0;
        font-size: 0.8rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
        box-sizing: border-box;
        white-space: pre-wrap;
        word-break: break-all;
    }
    
    code {
        font-size: 0.8rem;
        word-break: break-all;
        white-space: pre-wrap;
    }
    
    p code, li code, td code {
        font-size: 0.8rem;
        padding: 0.2rem 0.4rem;
        word-break: break-all;
        white-space: normal;
    }
    
    /* Tables */
    .parameter-table {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 1rem -1.5rem;
        padding: 0 1.5rem;
        width: calc(100% + 3rem);
        max-width: calc(100vw - 2rem);
        box-sizing: border-box;
    }
    
    .parameter-table table {
        min-width: 300px;
        width: 100%;
        table-layout: fixed;
    }
    
    .parameter-table th,
    .parameter-table td {
        padding: 0.75rem;
        font-size: 0.875rem;
        word-break: break-word;
        hyphens: auto;
    }
    
    /* Grids and layouts */
    .concept-grid,
    .flag-operations,
    .special-message-grid {
        flex-direction: column;
        gap: 1rem;
        width: 100%;
    }
    
    .concept-card,
    .flag-op,
    .special-msg {
        padding: 1rem;
        width: 100%;
        box-sizing: border-box;
        overflow-wrap: break-word;
    }
    
    .link-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        width: 100%;
    }
    
    .resource-link {
        padding: 1rem;
        width: 100%;
        box-sizing: border-box;
        word-break: break-word;
    }
    
    .spec-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        width: 100%;
    }
    
    .time-examples {
        grid-template-columns: 1fr;
        gap: 1rem;
        width: 100%;
    }
    
    .spec-card, .time-example {
        width: 100%;
        box-sizing: border-box;
        overflow-wrap: break-word;
    }
    
    /* Steps */
    .step {
        flex-direction: column;
        text-align: center;
        padding: 1rem;
        margin-bottom: 1rem;
        width: 100%;
        box-sizing: border-box;
        overflow-wrap: break-word;
    }
    
    .step-number {
        margin-right: 0;
        margin-bottom: 1rem;
        width: 2rem;
        height: 2rem;
        font-size: 0.875rem;
    }
    
    /* Info boxes */
    .info-box, .tip-box, .warning-box, .support-box, .example-box {
        padding: 1rem;
        margin: 1rem 0;
        border-radius: 8px;
        width: 100%;
        box-sizing: border-box;
        overflow-wrap: break-word;
    }
    
    /* Checklist */
    .checkbox-item {
        padding: 0.6rem;
        font-size: 0.875rem;
        width: 100%;
        box-sizing: border-box;
        word-break: break-word;
    }
    
    .checkbox-item input[type="checkbox"] {
        width: 1rem;
        height: 1rem;
        margin-right: 0.6rem;
        flex-shrink: 0;
    }
    
    /* File examples */
    .file-example {
        width: 100%;
        overflow-x: hidden;
    }
    
    .file-example h3 {
        padding: 0.6rem 1rem;
        font-size: 0.875rem;
        word-break: break-word;
    }
    
    .file-example pre {
        margin: 0;
        border-radius: 0 0 12px 12px;
    }
    
    /* Search container */
    .search-container {
        margin-bottom: 1rem;
        width: 100%;
        box-sizing: border-box;
    }
    
    /* Footer */
    .doc-footer {
        padding: 1.5rem 0;
        text-align: center;
        word-break: break-word;
    }
    
    .doc-footer p {
        font-size: 0.875rem;
        margin-bottom: 0.5rem;
        word-break: break-word;
    }
}

@media (max-width: 480px) {
    /* Extra small screens - strict width control */
    html, body {
        max-width: 100vw;
        overflow-x: hidden;
    }
    
    .container {
        padding: 0.5rem;
        max-width: 100vw;
        width: 100%;
        box-sizing: border-box;
    }
    
    .main-content {
        padding: 1rem;
        max-width: 100%;
        width: 100%;
        box-sizing: border-box;
    }
    
    .sidebar {
        padding: 1rem;
        max-width: 100%;
        width: 100%;
        box-sizing: border-box;
    }
    
    .doc-section {
        max-width: 100%;
        overflow-x: hidden;
    }
    
    .doc-section h1 {
        font-size: 1.5rem;
        word-break: break-word;
        hyphens: auto;
    }
    
    .doc-section h2 {
        font-size: 1.25rem;
        word-break: break-word;
        hyphens: auto;
    }
    
    .doc-section h3 {
        font-size: 1rem;
        word-break: break-word;
        hyphens: auto;
    }
    
    .nav-links {
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
        max-width: 100%;
    }
    
    .nav-links a {
        display: block;
        width: 100%;
        text-align: center;
        box-sizing: border-box;
        word-break: break-word;
    }
    
    pre {
        font-size: 0.75rem;
        padding: 0.75rem;
        max-width: 100%;
        overflow-x: auto;
        word-break: break-all;
        white-space: pre-wrap;
        box-sizing: border-box;
    }
    
    code {
        font-size: 0.75rem;
        word-break: break-all;
        white-space: pre-wrap;
    }
    
    p code, li code, td code {
        font-size: 0.75rem;
        word-break: break-all;
        white-space: normal;
    }
    
    .parameter-table {
        margin: 1rem -1rem;
        padding: 0 1rem;
        max-width: calc(100vw - 1rem);
        overflow-x: auto;
        box-sizing: border-box;
    }
    
    .parameter-table table {
        min-width: 280px;
        table-layout: fixed;
    }
    
    .parameter-table th,
    .parameter-table td {
        padding: 0.5rem;
        font-size: 0.8rem;
        word-break: break-word;
        hyphens: auto;
    }
    
    .step-number {
        width: 1.75rem;
        height: 1.75rem;
        font-size: 0.8rem;
    }
    
    .info-box, .tip-box, .warning-box, .support-box, .example-box {
        padding: 0.75rem;
        max-width: 100%;
        box-sizing: border-box;
        overflow-wrap: break-word;
    }
    
    .concept-card, .flag-op, .special-msg, .spec-card, .time-example {
        padding: 0.75rem;
        max-width: 100%;
        box-sizing: border-box;
        overflow-wrap: break-word;
    }
    
    .file-example {
        max-width: 100%;
        overflow-x: hidden;
    }
    
    .resource-link {
        padding: 0.75rem;
        max-width: 100%;
        box-sizing: border-box;
        word-break: break-word;
    }
}

/* Print Styles */
@media print {
    .navbar,
    .sidebar {
        display: none;
    }
    
    .container {
        grid-template-columns: 1fr;
        max-width: none;
        margin: 0;
        padding: 0;
    }
    
    .main-content {
        box-shadow: none;
        border: none;
        padding: 0;
    }
} 