/* ═══════════════════════════════════════════════════════════
   Author Platform — Shared Documentation Layout
   Used by: rules.html, instructions.html, etc.
   ═══════════════════════════════════════════════════════════ */

:root {
    --bg-0: #06060c;
    --bg-1: #0b0b16;
    --bg-2: #111122;
    --bg-3: #181832;
    --bg-4: #1f1f40;
    --bg-5: #26264e;
    --border: #222244;
    --border-light: #333360;
    --border-hover: #444480;
    --accent: #7c5cfc;
    --accent-hover: #9178ff;
    --accent-dim: rgba(124, 92, 252, 0.10);
    --accent-soft: rgba(124, 92, 252, 0.18);
    --accent-glow: rgba(124, 92, 252, 0.35);
    --text-1: #e8e8f0;
    --text-2: #9494b8;
    --text-3: #5c5c80;
    --green: #34d399;
    --green-dim: rgba(52, 211, 153, 0.12);
    --yellow: #fbbf24;
    --yellow-dim: rgba(251, 191, 36, 0.12);
    --red: #f87171;
    --red-dim: rgba(248, 113, 113, 0.12);
    --font: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-full: 9999px;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 24px var(--accent-glow);
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --transition: 0.2s var(--ease);
    --transition-slow: 0.35s var(--ease);
}

/* ── Reset ───────────────────────────────────────────────── */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-1);
    background: var(--bg-0);
    min-height: 100vh;
    overflow-x: hidden;
}

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

a:hover {
    color: var(--accent-hover);
}

img {
    max-width: 100%;
    display: block;
}

::selection {
    background: var(--accent-soft);
    color: var(--text-1);
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-1);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-4);
    border-radius: 3px;
}

/* ── Nav ─────────────────────────────────────────────────── */
.cat-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 16px;
    height: 56px;
    padding: 0 24px;
    background: rgba(6, 6, 12, 0.85);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
}

.cat-nav .logo {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-1);
    display: flex;
    align-items: center;
    gap: 4px;
}

.cat-nav .nav-links {
    display: flex;
    gap: 6px;
    margin-left: 32px;
}

.cat-nav .nav-link {
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-2);
    transition: all var(--transition);
}

.cat-nav .nav-link:hover {
    color: var(--text-1);
    background: var(--bg-3);
}

.cat-nav .nav-link.active {
    color: var(--text-1);
    background: var(--accent-dim);
}

.cat-nav .nav-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn-primary {
    padding: 7px 18px;
    border: none;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

/* ── Layout ──────────────────────────────────────────────── */
.docs-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 40px;
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px 32px 80px;
}

/* ── TOC ─────────────────────────────────────────────────── */
.docs-toc {
    position: sticky;
    top: 72px;
    align-self: start;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.toc-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-3);
    margin-bottom: 8px;
}

.toc-link {
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-3);
    border-left: 2px solid transparent;
    transition: all var(--transition);
}

.toc-link:hover {
    color: var(--text-2);
    background: var(--bg-2);
}

.toc-link.active {
    color: var(--accent);
    border-left-color: var(--accent);
    background: var(--accent-dim);
}

/* ── Content ─────────────────────────────────────────────── */
.docs-content {
    min-width: 0;
}

.docs-content h1 {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 28px;
    display: flex;
    align-items: center;
}

.docs-content h2 {
    font-size: 20px;
    font-weight: 700;
    margin: 40px 0 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.docs-content h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-2);
    margin: 20px 0 12px;
}

.docs-content h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-1);
    margin: 16px 0 8px;
}

.docs-content p {
    color: var(--text-2);
    margin-bottom: 16px;
    line-height: 1.75;
}

.section-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #fff;
}

/* ── Intro box ───────────────────────────────────────────── */
.docs-intro-box {
    padding: 16px 20px;
    background: var(--bg-2);
    border-left: 3px solid var(--accent);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    color: var(--text-2);
    line-height: 1.75;
    font-size: 15px;
    margin-bottom: 8px;
}

.docs-intro-box strong {
    color: var(--accent);
}

/* ── Notice boxes ────────────────────────────────────────── */
.docs-notice {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 14px 18px;
    background: var(--yellow-dim);
    border: 1px solid rgba(251, 191, 36, 0.25);
    border-radius: var(--radius-md);
    color: var(--yellow);
    font-size: 14px;
    line-height: 1.6;
    margin: 16px 0;
}

.docs-notice strong {
    color: var(--yellow);
}

.docs-notice div {
    flex: 1;
}

.notice-danger {
    background: var(--red-dim);
    border-color: rgba(248, 113, 113, 0.25);
    color: var(--red);
}

.notice-danger strong {
    color: var(--red);
}

.notice-info {
    background: var(--accent-dim);
    border-color: rgba(124, 92, 252, 0.25);
    color: #a78bfa;
}

.notice-info strong {
    color: #a78bfa;
}

.notice-green {
    background: var(--green-dim);
    border-color: rgba(52, 211, 153, 0.25);
    color: var(--green);
}

.notice-green strong {
    color: var(--green);
}

/* ── Docs list ───────────────────────────────────────────── */
.docs-list {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.docs-list li {
    padding: 10px 14px 10px 38px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-2);
    line-height: 1.6;
    position: relative;
}

.docs-list li::before {
    content: '•';
    position: absolute;
    left: 16px;
    top: 10px;
    color: var(--accent);
    font-size: 18px;
    font-weight: 700;
}

.docs-list li strong {
    color: var(--text-1);
}

.docs-list li em {
    color: var(--accent);
    font-style: normal;
}

.docs-list li code {
    background: var(--bg-3);
    padding: 1px 6px;
    border-radius: var(--radius-xs);
    font-size: 13px;
    color: var(--accent);
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

.danger-list li::before {
    color: var(--red);
}

.danger-list li {
    border-color: rgba(248, 113, 113, 0.15);
}

.danger-list li strong {
    color: var(--red);
}

/* ── Code block ──────────────────────────────────────────── */
.docs-code {
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    margin: 12px 0 20px;
    overflow-x: auto;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 13px;
    line-height: 1.7;
    color: var(--text-2);
    white-space: pre;
}

.docs-code .hl-key {
    color: #c084fc;
}

.docs-code .hl-str {
    color: #34d399;
}

.docs-code .hl-comment {
    color: var(--text-3);
    font-style: italic;
}

.docs-code .hl-tag {
    color: #f97316;
}

/* ── Feature card grid ───────────────────────────────────── */
.docs-feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
    margin: 16px 0 20px;
}

.docs-feature-card {
    padding: 16px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: border-color var(--transition);
}

.docs-feature-card:hover {
    border-color: var(--border-light);
}

.docs-feature-card h4 {
    font-size: 14px;
    font-weight: 700;
    margin: 0 0 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.docs-feature-card p {
    font-size: 13px;
    color: var(--text-3);
    margin: 0;
    line-height: 1.5;
}

.docs-feature-card .fc-icon {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-xs);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #fff;
}

/* ── Table ────────────────────────────────────────────────── */
.docs-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 12px 0 20px;
    font-size: 14px;
}

.docs-table th {
    text-align: left;
    padding: 10px 14px;
    background: var(--bg-3);
    color: var(--text-2);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}

.docs-table th:first-child {
    border-radius: var(--radius-sm) 0 0 0;
}

.docs-table th:last-child {
    border-radius: 0 var(--radius-sm) 0 0;
}

.docs-table td {
    padding: 10px 14px;
    background: var(--bg-2);
    color: var(--text-2);
    border-bottom: 1px solid var(--border);
    line-height: 1.5;
}

.docs-table td code {
    background: var(--bg-3);
    padding: 1px 6px;
    border-radius: var(--radius-xs);
    font-size: 13px;
    color: var(--accent);
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

.docs-table tr:last-child td:first-child {
    border-radius: 0 0 0 var(--radius-sm);
}

.docs-table tr:last-child td:last-child {
    border-radius: 0 0 var(--radius-sm) 0;
}

/* ── Footer ──────────────────────────────────────────────── */
.docs-footer {
    margin-top: 48px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    text-align: center;
}

.docs-footer p {
    color: var(--text-3);
    font-size: 13px;
    margin-bottom: 4px;
}

.docs-date {
    font-size: 12px;
    color: var(--text-3);
    opacity: 0.7;
}

/* ── Burger menu for docs pages ───────────────────────── */
.docs-mobile-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: none;
    color: var(--text-2);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background .15s;
    -webkit-tap-highlight-color: transparent;
}
.docs-mobile-menu-btn:hover {
    background: var(--bg-3);
    color: var(--text-1);
}

.docs-mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: var(--bg-1);
    flex-direction: column;
    padding: 16px 20px;
    overflow-y: auto;
    animation: docsOverlayIn .2s ease;
}
.docs-mobile-overlay.open {
    display: flex;
}
@keyframes docsOverlayIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.docs-mobile-overlay-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}
.docs-mobile-overlay-header .logo {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-1);
    display: flex;
    align-items: center;
    gap: 4px;
}
.docs-mobile-overlay .docs-nav-links {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.docs-mobile-overlay .docs-nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 15px;
    color: var(--text-2);
    transition: background .12s, color .12s;
}
.docs-mobile-overlay .docs-nav-link:hover,
.docs-mobile-overlay .docs-nav-link.active {
    background: var(--accent-dim);
    color: var(--text-1);
}
.docs-mobile-close-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    color: var(--text-2);
    cursor: pointer;
    border-radius: var(--radius-sm);
}

/* ── Mobile TOC (collapsible) ────────────────────────── */
.docs-toc-toggle {
    display: none;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-1);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 12px;
    font-family: var(--font);
    transition: background .15s;
}
.docs-toc-toggle:hover {
    background: var(--bg-4);
}
.docs-toc-toggle i {
    width: 18px;
    height: 18px;
    transition: transform .2s;
}
.docs-toc-toggle.open i {
    transform: rotate(180deg);
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 860px) {
    /* Burger */
    .docs-mobile-menu-btn {
        display: flex;
    }
    .cat-nav .nav-links {
        display: none;
    }
    .cat-nav .nav-right .nav-link span {
        display: none;
    }

    .docs-layout {
        grid-template-columns: 1fr;
        gap: 0;
        padding: 16px 16px 60px;
    }

    /* TOC → collapsible */
    .docs-toc-toggle {
        display: flex;
    }
    .docs-toc {
        position: static;
        display: none;
        flex-direction: column;
        gap: 4px;
        padding: 12px;
        margin-bottom: 16px;
        background: var(--bg-2);
        border: 1px solid var(--border);
        border-radius: var(--radius-md);
        border-top-left-radius: 0;
        border-top-right-radius: 0;
        margin-top: -13px;
        border-top: none;
    }
    .docs-toc.mobile-open {
        display: flex;
    }
    .toc-title {
        display: none;
    }
    .toc-link {
        border-left: none;
        padding: 8px 12px;
        font-size: 13px;
        border-radius: var(--radius-sm);
    }
    .toc-link:hover,
    .toc-link.active {
        background: var(--accent-dim);
    }

    .docs-feature-grid {
        grid-template-columns: 1fr;
    }
}

/* ── Lang Switcher (docs nav) ────────────────────────── */
.lang-switcher {
    position: relative;
}

.lang-switcher-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 0 10px;
    height: 34px;
    border: 1px solid transparent;
    background: none;
    color: var(--text-2);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.05em;
    font-family: var(--font);
}

.lang-switcher-btn:hover {
    color: var(--text-1);
    background: var(--bg-3);
    border-color: var(--border-light);
}

.lang-switcher-btn i,
.lang-switcher-btn svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.lang-switcher-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 190px;
    background: var(--bg-2);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    z-index: 1100;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.lang-switcher-dropdown:not(.open) {
    display: none;
}

.lang-switcher-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: transparent;
    color: var(--text-2);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    font-family: var(--font);
    transition: background 0.2s ease, color 0.2s ease;
    text-align: left;
}

.lang-switcher-item:hover {
    background: var(--bg-3);
    color: var(--text-1);
}

.lang-switcher-item.active {
    color: var(--accent);
    background: var(--accent-dim);
}

.lang-switcher-item-name {
    flex: 1;
}

.lang-switcher-item-code {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-3);
    letter-spacing: 0.06em;
    margin-left: 8px;
}

.lang-switcher-item.active .lang-switcher-item-code {
    color: var(--accent);
}