body {
    font-family: 'Roboto', Arial, sans-serif;
    background: #f4f6f8c4;
    margin: 0;
    color: #222;
}
h1 {
    text-align: center;
    font-size: 2.5em;
    margin-bottom: 10px;
    color: #1976d2;
}
.intro {
    text-align: center;
    font-size: 1.2em;
    margin-bottom: 32px;
}
.rule-card {
    background: #cdd1d4;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    margin-bottom: 32px;
    padding: 10px 10px;
}
h2 {
    font-size: 1.6em;
    color: #fff;
    background: linear-gradient(135deg, #1976d2, #1565c0);
    margin-bottom: 16px;
    margin-top: 10px;
    padding: 16px 18px;
    border-radius: 8px;
    border-left: 5px solid #0d47a1;
    font-weight: 700;
    letter-spacing: 0.3px;
    box-shadow: 0 2px 8px rgba(25, 118, 210, 0.15);
}
h3 {
    font-size: 1.15em;
    color: #1565c0;
    margin-top: 15px;
    margin-bottom: 8px;
}
.rule-desc {
    font-size: 1.1em;
    margin-bottom: 16px;
}
blockquote {
    background: #e3f2fd;
    border-left: 4px solid #1976d2;
    margin: 16px 0;
    padding: 12px 18px;
    border-radius: 6px;
}
ul, ol {
    margin-left: 24px;
}
img {
    max-width: 100%;
    border-radius: 6px;
    margin: 12px 0;
}
a {
    color: #1976d2;
    text-decoration: underline;
}
hr {
    border: none;
    border-top: 1px solid #e0e0e0;
    margin: 32px 0;
}
/* Floating TOC sidebar */
.toc-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    height: 100vh;
    background: #fff;
    border-radius: 0;
    box-shadow: 2px 0 12px rgba(0,0,0,0.08);
    padding: 0 16px;
    z-index: 1002;
    font-size: 0.85em;
    overflow-y: auto;
    border-right: 1px solid #e0e0e0;
    transition: transform 0.3s ease;
    transform: translateX(-100%);
}
nav.toc-sidebar.open {
    transform: translateX(0) !important;
}
.toc-sidebar h2 {
    font-size: 1.1em;
    margin: 0 -16px 8px -16px; /* stretch full width of sidebar */
    padding: 14px 16px;
    color: #ffffff;
    text-align: left;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    background: linear-gradient(135deg, #1976d2, #1565c0);
    border-bottom: none;
    border-left: none;
    box-shadow: 0 2px 8px rgba(25, 118, 210, 0.2);
}
.toc-list {
    list-style: none;
    padding-left: 0;
    margin: 0;
    padding-top: 4px;
}
.toc-rule {
    margin-bottom: 12px;
    border-radius: 6px;
    overflow: hidden;
}
.toc-rule-header {
    background: linear-gradient(135deg, #1976d2, #1565c0);
    color: white;
    padding: 10px 12px;
    font-weight: bold;
    font-size: 1em;
    cursor: pointer;
    transition: background 0.2s;
}
.toc-rule-header:hover {
    background: linear-gradient(135deg, #1565c0, #0d47a1);
}
.toc-rule-content {
    background: #f8f9fa;
    border: 1px solid #e3f2fd;
    border-top: none;
}
.toc-subitems {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 8px;
}
.toc-subitem {
    background: #e3f2fd;
    color: #1565c0;
    padding: 6px 8px;
    border-radius: 4px;
    font-size: 0.95em;
    text-decoration: none;
    transition: all 0.2s;
    border: 1px solid transparent;
    display: flex;
    align-items: center;
}
.toc-subitem:hover {
    background: #1976d2;
    color: white;
    transform: translateX(2px);
}
.toc-subitem-number {
    background: #1976d2;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9em;
    font-weight: bold;
    margin-right: 6px;
    flex-shrink: 0;
}
.toc-rule-header a {
    color: white;
    text-decoration: none;
}
.toc-rule-header a:hover {
    color: white;
}
.toc-sidebar.open {
    transform: translateX(0);
}
/* Layout with proper space reservation */
.page-wrapper {
    margin-left: 300px; /* Reserve space for TOC */
    margin-right: 20px;
}
.container {
    margin: 40px auto;
    padding: 32px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08);
    max-width: 900px;
}
@media (max-width: 1200px) {
    .toc-sidebar {
        width: 240px;
    }
    .page-wrapper {
        margin-left: 280px;
    }
}
@media (max-width: 1024px) {
    .page-wrapper {
        margin-left: 20px;
        margin-right: 20px;
    }
}
@media (max-width: 600px) {
    .page-wrapper {
        margin: 8px;
    }
    .container {
        padding: 16px;
    }
    h1 {
        font-size: 1.8em;
    }
    h2 {
        font-size: 1.3em;
        padding: 12px 14px;
    }
}
/* Mobile TOC toggle button */
.toc-toggle {
    display: flex;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 1001;
    background: #1976d2;
    color: white;
    border: none;
    padding: 10px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.2em;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-direction: column;
    gap: 4px;
}
.toc-toggle:hover {
    background: #1565c0;
}
.toc-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: white;
}
@media (max-width: 1024px) {
    .toc-toggle {
        display: flex;
    }
    .toc-sidebar h2 {
        font-size: 1.1em;
        padding: 14px 16px;
    }
    .toc-rule-header {
        font-size: 1em;
        padding: 10px 12px;
    }
    .toc-subitem {
        font-size: 0.95em;
        padding: 6px 8px;
    }
    .toc-subitem-number {
        width: 18px;
        height: 18px;
        font-size: 0.9em;
    }
}
@media (min-width: 1025px) {
    .toc-toggle {
        display: none;
    }
    .toc-sidebar {
        transform: translateX(0) !important;
    }
}
