:root {
    --bg-dark: #121212;
    --bg-card: #1E1E1E;
    --bg-sidebar: #1a1a1a;
    --primary: #E5CFA0;
    --accent: #B71C1C;
    --text: #FFFFFF;
    --text-secondary: #CCCCCC;
    --text-muted: #888888;
    --border: #333333;
    --code-bg: #0d0d0d;
    --link: #E5CFA0;
    --link-hover: #f5dfb0;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text);
    font-family: 'Outfit', sans-serif;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Header */
.docs-header {
    background: var(--bg-card);
    border-bottom: 2px solid var(--primary);
    padding: 15px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo {
    width: 50px;
    height: auto;
    filter: drop-shadow(0 0 5px rgba(0, 0, 0, 0.8));
}

.logo-link {
    text-decoration: none;
}

.docs-title {
    font-family: 'Press Start 2P', cursive;
    font-size: 1.2rem;
    color: var(--primary);
    text-shadow: 2px 2px 0px #000;
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: 2px solid var(--primary);
    padding: 8px;
    cursor: pointer;
    margin-left: auto;
}

.mobile-menu-toggle span {
    display: block;
    width: 25px;
    height: 3px;
    background: var(--primary);
    margin: 4px 0;
    transition: 0.3s;
}

/* Container */
.docs-container {
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
    min-height: calc(100vh - 80px);
}

/* Sidebar */
.docs-sidebar {
    width: 280px;
    background: var(--bg-sidebar);
    border-right: 2px solid var(--border);
    height: calc(100vh - 82px);
    position: sticky;
    top: 82px;
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform 0.3s ease, width 0.3s ease;
    flex-shrink: 0;
}

.docs-sidebar.collapsed {
    transform: translateX(-280px);
    width: 0;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
}

/* Collapsible Navigation Sections */
.nav-section-header {
    padding: 12px 25px;
    color: var(--primary);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-section-header::after {
    content: '▶';
    font-size: 0.7rem;
    transition: transform 0.2s;
}

.nav-section-header.expanded::after {
    transform: rotate(90deg);
}

.nav-section-header:hover {
    background: rgba(229, 207, 160, 0.05);
}

.nav-section-content {
    display: none;
    flex-direction: column;
}

.nav-link {
    display: block;
    padding: 12px 25px;
    color: var(--text-secondary);
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: all 0.2s;
    font-size: 0.95rem;
    font-weight: 500;
}

.nav-link.sub {
    padding-left: 45px;
    font-size: 0.88rem;
    font-weight: 400;
}

.nav-link:hover {
    color: var(--primary);
    background: rgba(229, 207, 160, 0.05);
    border-left-color: var(--primary);
}

.nav-link.active {
    color: var(--primary);
    background: rgba(229, 207, 160, 0.1);
    border-left-color: var(--primary);
    font-weight: 600;
}

/* Scrollbar for sidebar */
.docs-sidebar::-webkit-scrollbar {
    width: 6px;
}

.docs-sidebar::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

.docs-sidebar::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.docs-sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Main Content */
.docs-content {
    flex: 1;
    padding: 40px 60px;
    max-width: 900px;
}

.doc-section {
    margin-bottom: 60px;
    scroll-margin-top: 100px;
}

.doc-section h2 {
    font-family: 'Press Start 2P', cursive;
    font-size: 1.8rem;
    color: var(--primary);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border);
    text-shadow: 2px 2px 0px #000;
}

.doc-section h3 {
    font-family: 'Press Start 2P', cursive;
    font-size: 1.2rem;
    color: var(--text);
    margin-top: 30px;
    margin-bottom: 15px;
    text-shadow: 1px 1px 0px #000;
}

.doc-section h4 {
    font-size: 1.1rem;
    color: var(--primary);
    margin-top: 20px;
    margin-bottom: 10px;
    font-weight: 600;
}

.doc-section h5 {
    font-size: 1rem;
    color: var(--text);
    margin-top: 15px;
    margin-bottom: 10px;
    font-weight: 600;
}

.doc-section p {
    margin-bottom: 15px;
    color: var(--text-secondary);
}

.doc-section ul,
.doc-section ol {
    margin-left: 25px;
    margin-bottom: 15px;
    color: var(--text-secondary);
}

.doc-section li {
    margin-bottom: 8px;
}

.doc-section a {
    color: var(--link);
    text-decoration: none;
    border-bottom: 1px dotted var(--link);
    transition: color 0.2s;
}

.doc-section a:hover {
    color: var(--link-hover);
    border-bottom-color: var(--link-hover);
}

.doc-section strong {
    color: var(--text);
    font-weight: 600;
}

/* Code */
code {
    background: var(--code-bg);
    color: var(--primary);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

code.address {
    display: inline-block;
    background: var(--code-bg);
    color: var(--primary);
    padding: 8px 12px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.85em;
    border: 1px solid var(--border);
    word-break: break-all;
    margin: 10px 0;
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
}

.data-table thead {
    background: rgba(229, 207, 160, 0.1);
}

.data-table th {
    padding: 12px;
    text-align: left;
    color: var(--primary);
    font-weight: 600;
    border-bottom: 2px solid var(--border);
    font-family: 'Press Start 2P', cursive;
    font-size: 0.7rem;
}

.data-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
}

.data-table tbody tr:hover {
    background: rgba(229, 207, 160, 0.05);
}

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

/* Info Boxes */
.info-box {
    background: rgba(41, 98, 255, 0.1);
    border-left: 4px solid #2962ff;
    padding: 20px;
    margin: 20px 0;
    border-radius: 4px;
}

.info-box h3,
.info-box h4 {
    color: #5e9aff;
    margin-top: 0;
    margin-bottom: 10px;
}

.info-box p,
.info-box ul,
.info-box li {
    color: var(--text-secondary);
}

.warning-box {
    background: rgba(255, 152, 0, 0.1);
    border-left: 4px solid #ff9800;
    padding: 20px;
    margin: 20px 0;
    border-radius: 4px;
    color: var(--text-secondary);
}

.warning-box strong {
    color: #ffb74d;
}

.npc-box {
    background: rgba(229, 207, 160, 0.05);
    border: 2px solid var(--border);
    padding: 20px;
    margin: 20px 0;
    border-radius: 4px;
}

.npc-box p {
    margin-bottom: 10px;
}

.formula-box {
    background: var(--code-bg);
    border: 1px solid var(--border);
    padding: 15px;
    margin: 15px 0;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
}

.formula-box p {
    color: var(--primary);
    margin-bottom: 8px;
}

.formula-box p:last-child {
    margin-bottom: 0;
}

/* PSG1 Controls Section */
.psg1-controls-section {
    display: flex;
    gap: 24px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.psg1-image {
    flex: 1;
    min-width: 300px;
}

.psg1-image img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    border: 2px solid var(--border);
}

.sidebar-toggle {
    background: var(--primary);
    color: var(--bg-dark);
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: bold;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-toggle:hover {
    background: var(--link-hover);
    transform: scale(1.05);
}

.sidebar-toggle span {
    display: block;
    line-height: 1;
}

.psg1-controls-list {
    flex: 1;
    min-width: 300px;
}

.psg1-controls-list h5 {
    color: var(--primary);
    margin-top: 16px;
    margin-bottom: 8px;
}

.psg1-controls-list ul {
    margin-left: 0;
    padding-left: 20px;
}

/* Footer */
.docs-footer {
    margin-top: 60px;
    padding-top: 30px;
    border-top: 2px solid var(--border);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.docs-footer p {
    margin-bottom: 10px;
}

.docs-footer a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s;
}

.docs-footer a:hover {
    color: var(--link-hover);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .docs-content {
        padding: 30px 40px;
    }

    .docs-sidebar {
        width: 240px;
    }
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: block;
    }

    .docs-container {
        flex-direction: column;
    }

    .docs-sidebar {
        position: fixed;
        left: -100%;
        top: 80px;
        width: 280px;
        height: calc(100vh - 80px);
        z-index: 90;
        transition: left 0.3s;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.5);
    }

    .docs-sidebar.active {
        left: 0;
    }

    .docs-content {
        padding: 20px;
        max-width: 100%;
    }

    .doc-section h2 {
        font-size: 1.3rem;
    }

    .doc-section h3 {
        font-size: 1rem;
    }

    .data-table {
        font-size: 0.85rem;
    }

    .data-table th {
        font-size: 0.6rem;
        padding: 8px;
    }

    .data-table td {
        padding: 8px;
    }

    code.address {
        font-size: 0.7em;
    }

    .psg1-controls-section {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .docs-title {
        font-size: 0.9rem;
    }

    .logo {
        width: 40px;
    }

    .doc-section h2 {
        font-size: 1.1rem;
    }

    .doc-section h3 {
        font-size: 0.9rem;
    }

    .data-table {
        font-size: 0.75rem;
    }

    .data-table th,
    .data-table td {
        padding: 6px;
    }
}