@import 'https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap';

:root {
    --bg-dark: #17161d;
    --text-color: #E3E9F1;
    --text-muted: #a1a9c0;
    --text-fade: rgba(255, 255, 255, 0.4);
    --accent: #FFCC00;
    --accent-hover: #dcb416;
    --accent-glow: rgba(255, 204, 0, 0.25);
    --panel-bg: rgba(23, 22, 29, 0.88);
    --panel-card-bg: rgba(30, 29, 38, 0.7);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-highlight: rgba(255, 204, 0, 0.3);
    --badge-bg: rgba(255, 204, 0, 0.12);
    --badge-color: #FFCC00;
}

* {
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    font-family: 'Poppins', system-ui, -apple-system, sans-serif;
    color: var(--text-color);
    background-color: var(--bg-dark);
    background-image: url('../img/bg.png');
    background-size: cover;
    background-attachment: fixed;
    font-size: 15px;
    line-height: 1.7;
}

/* Header Navigation */
.reg-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1400px;
    margin: 0 auto;
    padding: 25px 40px;
}

.reg-head img {
    height: 50px;
    width: auto;
}

.reg-head-right {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.reg-head-right a {
    font-weight: 500;
    font-size: 16px;
    color: var(--text-fade);
    text-decoration: none;
    transition: color 0.25s ease;
}

.reg-head-right a:hover,
.reg-head-right a.active {
    color: #fff;
    font-weight: 600;
}

.reg-head-right a.active {
    position: relative;
}

.reg-head-right a.active::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--accent);
    border-radius: 2px;
    box-shadow: 0 0 10px var(--accent-glow);
}

/* Hero Section */
.hero-section {
    text-align: center;
    padding: 60px 20px 40px;
    max-width: 1000px;
    margin: 0 auto;
}

.hero-badge {
    display: inline-block;
    background: var(--badge-bg);
    color: var(--accent);
    border: 1px solid var(--border-highlight);
    border-radius: 20px;
    padding: 6px 18px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-bottom: 16px;
}

.hero-title {
    font-size: 46px;
    font-weight: 800;
    line-height: 1.2;
    margin: 0 0 12px;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.hero-title span {
    color: var(--accent);
}

.hero-subtitle {
    font-size: 16px;
    color: var(--text-muted);
    max-width: 650px;
    margin: 0 auto 30px;
}

/* Search Bar */
.search-container {
    max-width: 650px;
    margin: 0 auto 20px;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 16px 22px 16px 50px;
    background: rgba(23, 22, 29, 0.85);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: #fff;
    font-size: 15px;
    font-family: inherit;
    outline: none;
    backdrop-filter: blur(10px);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 20px rgba(255, 204, 0, 0.15);
}

.search-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    fill: var(--text-muted);
    pointer-events: none;
}

/* Main Layout Grid */
.reg-container {
    max-width: 1400px;
    margin: 0 auto 100px;
    padding: 0 40px;
    display: grid;
    grid-template-columns: 310px 1fr;
    gap: 40px;
}

/* Sidebar TOC */
.sidebar {
    position: sticky;
    top: 30px;
    height: fit-content;
    max-height: calc(100vh - 60px);
    overflow-y: auto;
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    backdrop-filter: blur(10px);
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}
.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

.sidebar-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-item {
    margin-bottom: 6px;
}

.toc-link {
    display: block;
    padding: 10px 14px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.toc-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.toc-link.active {
    color: #fff;
    background: var(--badge-bg);
    border-left: 3px solid var(--accent);
    font-weight: 600;
}

/* Content Area */
.content-area {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.chapter-card {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    padding: 40px;
    backdrop-filter: blur(10px);
    scroll-margin-top: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.chapter-header {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 20px;
    margin-bottom: 30px;
}

.chapter-tag {
    font-size: 12px;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 6px;
    display: inline-block;
}

.chapter-title {
    font-size: 26px;
    font-weight: 700;
    color: #fff;
    margin: 0;
}

/* Rule Block Styling */
.rule-item {
    background: var(--panel-card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px 28px;
    margin-bottom: 24px;
    transition: border-color 0.25s ease, transform 0.25s ease;
    scroll-margin-top: 30px;
}

.rule-item:hover {
    border-color: var(--border-highlight);
}

.rule-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.rule-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.rule-code {
    background: var(--badge-bg);
    color: var(--accent);
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 6px;
    font-family: monospace;
}

.rule-title {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    margin: 0;
}

.copy-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.2);
}

.rule-body {
    color: var(--text-color);
    font-size: 14.5px;
    line-height: 1.7;
}

.rule-body p {
    margin: 0 0 12px;
}

.rule-body p:last-child {
    margin-bottom: 0;
}

/* Callout Boxes */
.callout {
    background: rgba(255, 204, 0, 0.05);
    border-left: 4px solid var(--accent);
    border-radius: 0 8px 8px 0;
    padding: 16px 20px;
    margin: 16px 0;
}

.callout-title {
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 6px;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.callout-danger {
    background: rgba(244, 67, 54, 0.08);
    border-left-color: #f44336;
}

.callout-danger .callout-title {
    color: #ff6b6b;
}

.callout-info {
    background: rgba(33, 150, 243, 0.08);
    border-left-color: #2196f3;
}

.callout-info .callout-title {
    color: #64b5f6;
}

/* Lists inside rules */
.rule-list {
    padding-left: 20px;
    margin: 10px 0 16px;
}

.rule-list li {
    margin-bottom: 6px;
}

/* Footer Styling */
.reg-footer {
    background: #111015;
    border-top: 1px solid var(--border-color);
    padding: 60px 40px 30px;
}

.footer-grid {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

.footer-col h4 {
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    margin: 0 0 18px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links li {
    margin-bottom: 10px;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s ease;
}

.footer-links a:hover {
    color: #fff;
}

.footer-bottom {
    max-width: 1400px;
    margin: 0 auto;
    padding-top: 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    text-align: center;
    color: var(--text-fade);
    font-size: 13px;
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 46px;
    height: 46px;
    background: var(--accent);
    color: #17161d;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(255, 204, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 99;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: #fff;
    transform: translateY(-3px);
}

/* Toast notification */
.toast-msg {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #FFCC00;
    color: #17161d;
    padding: 10px 22px;
    border-radius: 30px;
    font-weight: 600;
    font-size: 14px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 999;
}

.toast-msg.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Responsive Breakpoints */
@media (max-width: 1024px) {
    .reg-container {
        grid-template-columns: 1fr;
        padding: 0 20px;
    }
    
    .sidebar {
        position: static;
        max-height: none;
        margin-bottom: 30px;
    }

    .footer-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 640px) {
    .reg-head {
        flex-direction: column;
        gap: 16px;
        padding: 20px;
    }

    .hero-title {
        font-size: 30px;
    }

    .chapter-card {
        padding: 24px 18px;
    }

    .rule-item {
        padding: 18px;
    }

    .footer-grid {
        grid-template-columns: 1fr;
    }
}
