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

:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --text-primary: #1a1a1a;
    --text-secondary: #4a4a4a;
    --accent: #3b82f6;
    --border: #e0e0e0;
    --code-bg: #f0f0f0;
}

[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --accent: #60a5fa;
    --border: #404040;
    --code-bg: #2d2d2d;
}

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

.header {
    position: sticky;
    top: 0;
    background-color: var(--bg-secondary);
    border-bottom: 2px solid var(--border);
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
}

.header h1 {
    font-size: 1.75rem;
    font-weight: 700;
}

.theme-toggle {
    background: var(--accent);
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: opacity 0.2s;
}

.theme-toggle:hover {
    opacity: 0.9;
}

.container {
    display: flex;
    gap: 0;
    padding: 0;
    margin: 0;
}

.index {
    position: sticky;
    top: 100px;
    height: fit-content;
    max-height: calc(100vh - 120px);
    overflow: auto;
    background-color: var(--bg-secondary);
    border-radius: 0;
    padding: 1.5rem;
    margin: 0;
    max-width: 800px;
}

.resizer {
    width: 3px;
    height: 100vh;
    background: var(--accent);
    opacity: 0.5;
    cursor: col-resize;
    position: sticky;
    top: 100px;
}

.index h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.index ul {
    list-style: none;
}

.index li {
    margin-bottom: 0.6rem;
}

.index a {
    color: var(--accent);
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.index a:hover {
    text-decoration: underline;
}

.content {
    background-color: var(--bg-secondary);
    border-radius: 0;
    padding: 2.5rem;
    margin: 0;
    flex: 1;
}

.rule-section {
    margin-bottom: 2rem;
    scroll-margin-top: 100px;
}

.main-rule {
    margin-top: 3rem;
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid var(--border);
}

.main-rule .rule-number {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.main-rule .rule-text {
    font-size: 1.3rem;
    font-weight: 500;
}

.sub-rule {
    margin-left: 2rem;
}

.rule-number {
    color: var(--accent);
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.rule-text {
    margin-bottom: 1rem;
    color: var(--text-secondary);
    text-align: left;
}

.rule-text a {
    text-decoration: none;
    color: var(--accent);
}

.example {
    background-color: var(--code-bg);
    border-left: 3px solid var(--accent);
    padding: 1rem;
    margin: 1rem 0 1rem 0;
    border-radius: 4px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.example-label {
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.example > div {
    margin-bottom: 0.5rem;
}

.example > div:last-child {
    margin-bottom: 0;
}


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

    .index {
        position: static;
        max-height: none;
        width: 100%;
        min-width: unset;
        max-width: unset;
    }

    .resizer {
        display: none;
    }
}
