.rules-wrapper {
    display: flex;
    gap: 50px;
    padding-bottom: 80px;
    position: relative;
    max-width: 1300px;
    width: 95%;
    margin: 40px auto;
    padding: 0 20px;
}

.rules-sidebar {
    width: 260px;
    flex-shrink: 0;
    position: sticky;
    top: 120px;
    height: calc(100vh - 140px);
    overflow-y: auto;
    padding-right: 15px;
    border-right: 1px solid #334155;
}

.rules-sidebar::-webkit-scrollbar { width: 4px; }
.rules-sidebar::-webkit-scrollbar-track { background: transparent; }
.rules-sidebar::-webkit-scrollbar-thumb { background: #334155; border-radius: 4px; }
.rules-sidebar::-webkit-scrollbar-thumb:hover { background: #475569; }

.nav-link {
    display: block;
    padding: 10px 15px;
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.95em;
    border-radius: 6px;
    margin-bottom: 4px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #e2e8f0;
    padding-left: 20px;
}

.nav-link.active {
    background: rgba(13, 110, 253, 0.1);
    color: #0D6EFD;
    border-left-color: #0D6EFD;
    font-weight: 600;
}

.rules-content {
    flex-grow: 1;
    min-width: 0;
}

.rule-section {
    margin-bottom: 60px;
    scroll-margin-top: 130px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 40px;
}

.rule-section:last-child { border-bottom: none; }

h1.main-title {
    font-size: 2.8em;
    margin-bottom: 40px;
    background: linear-gradient(135deg, #f8fafc 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

h2 {
    color: #f1f5f9;
    font-size: 1.8em;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 10px;
    border-bottom: 2px solid rgba(13, 110, 253, 0.2);
}

h2::before {
    content: '#';
    color: #0D6EFD;
    font-weight: 300;
    opacity: 0.6;
}

h3 {
    color: #60a5fa;
    font-size: 1.3em;
    margin-top: 35px;
    margin-bottom: 15px;
    font-weight: 600;
}

p {
    color: #cbd5e1;
    line-height: 1.8;
    margin-bottom: 20px;
    font-size: 1.05em;
    text-align: justify;
}

ul {
    list-style: none;
    padding-left: 0;
    margin-bottom: 25px;
}

ul li {
    position: relative;
    padding-left: 30px;
    margin-bottom: 12px;
    color: #cbd5e1;
    line-height: 1.6;
}

ul li::before {
    content: '➤';
    color: #0D6EFD;
    position: absolute;
    left: 0;
    top: 2px;
    font-size: 0.8em;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.stat-card {
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid #334155;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.stat-card:hover {
    transform: translateY(-5px);
    border-color: #0D6EFD;
    background: rgba(30, 41, 59, 0.8);
    box-shadow: 0 8px 25px rgba(13, 110, 253, 0.15);
}

.stat-value {
    display: block;
    font-size: 1.6em;
    font-weight: 700;
    color: #0D6EFD;
    margin-bottom: 8px;
}

.stat-value.danger { color: #ef4444; }

.stat-label {
    font-size: 0.85em;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.formula-box {
    background: #0f172a;
    border-left: 4px solid #10b981;
    padding: 20px;
    margin: 20px 0;
    border-radius: 0 8px 8px 0;
    font-family: 'Consolas', 'Monaco', monospace;
    color: #e2e8f0;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
}

.img-box {
    margin: 40px 0;
    background: rgba(15, 23, 42, 0.5);
    border: 1px dashed #475569;
    border-radius: 16px;
    padding: 15px;
    text-align: center;
    transition: border-color 0.3s;
}

.img-box:hover {
    border-color: #0D6EFD;
}

.img-box img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    display: block;
    margin: 0 auto;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.img-caption {
    display: block;
    margin-top: 15px;
    color: #64748b;
    font-style: italic;
    font-size: 0.9em;
}

@media (max-width: 900px) {
    .rules-wrapper {
        flex-direction: column;
        margin: 20px auto;
        width: 90%;
        gap: 30px;
    }

    .rules-sidebar {
        position: relative;
        width: 100%;
        height: auto;
        top: 0;
        border-right: none;
        border-bottom: 1px solid #334155;
        padding-bottom: 20px;
    }

    h1.main-title { font-size: 2em; text-align: center; }
}