:root {
    --bg: #110e0c;
    --bg-elevated: #1f1c19;
    --bg-hover: #262320;
    --text: #fffbed;
    --text-muted: #9a9389;
    --text-secondary: #d4cfc8;
    --accent: #af690b;
    --accent-bright: #eabf36;
    --chain: #dbdffd;
    --border: rgba(219, 223, 253, 0.12);
    --danger: #e07070;
    --font: "Kanit", sans-serif;
    --mono: "JetBrains Mono", monospace;
    --radius: 10px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font);
    color: var(--text);
    background:
        radial-gradient(ellipse 80% 50% at 50% -10%, rgba(175, 105, 11, 0.18), transparent 55%),
        radial-gradient(ellipse 50% 40% at 100% 100%, rgba(91, 57, 234, 0.12), transparent 50%),
        var(--bg);
    line-height: 1.55;
}

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

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

code {
    font-family: var(--mono);
    font-size: 0.9em;
    background: rgba(255, 255, 255, 0.06);
    padding: 0.1em 0.35em;
    border-radius: 4px;
}

.brand {
    color: var(--text);
    font-weight: 600;
    letter-spacing: 0.02em;
}

.brand span {
    color: var(--accent-bright);
    font-weight: 400;
}

.site-header,
.docs-topbar {
    border-bottom: 1px solid var(--border);
    background: rgba(17, 14, 12, 0.75);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 20;
}

.site-header-inner,
.docs-topbar-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.header-note,
.sidebar-label,
.login-label {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.home-main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 3rem 1.5rem 4rem;
}

.home-hero h1 {
    margin: 0 0 0.75rem;
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 600;
    letter-spacing: -0.02em;
}

.home-hero p {
    margin: 0 0 2.5rem;
    max-width: 36rem;
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.25rem;
}

.project-card {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1.35rem 1.4rem;
    background: linear-gradient(160deg, rgba(31, 28, 25, 0.95), rgba(17, 14, 12, 0.9));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: inherit;
    transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.project-card:hover {
    border-color: rgba(175, 105, 11, 0.55);
    transform: translateY(-2px);
    color: inherit;
    background: var(--bg-hover);
}

.project-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.project-card h2 {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 600;
}

.project-card p {
    margin: 0;
    color: var(--text-secondary);
    flex: 1;
}

.project-card-cta {
    color: var(--accent-bright);
    font-size: 0.95rem;
}

.status-pill {
    flex-shrink: 0;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    color: var(--chain);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.login-main,
.simple-main {
    max-width: 420px;
    margin: 0 auto;
    padding: 4rem 1.5rem;
}

.back-link {
    display: inline-block;
    margin-bottom: 1.5rem;
    color: var(--text-muted);
}

.login-card {
    padding: 1.75rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.login-card h1 {
    margin: 0.35rem 0 0.75rem;
    font-size: 1.75rem;
}

.login-copy {
    margin: 0 0 1.5rem;
    color: var(--text-secondary);
}

.field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 1.25rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.field input {
    width: 100%;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    font: inherit;
}

.field input:focus {
    outline: 2px solid rgba(234, 191, 54, 0.35);
    border-color: var(--accent);
}

.btn-primary {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 0;
    border-radius: 8px;
    background: linear-gradient(135deg, #af690b, #eabf36);
    color: #110e0c;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.btn-primary:hover {
    filter: brightness(1.05);
}

.form-error {
    margin: 0 0 1rem;
    color: var(--danger);
}

.docs-topbar-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.project-name {
    color: var(--text-secondary);
}

.text-link {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.docs-shell {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem;
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 2rem;
    align-items: start;
}

.docs-sidebar {
    position: sticky;
    top: 5rem;
    padding: 1rem;
    background: rgba(31, 28, 25, 0.55);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.doc-nav {
    list-style: none;
    margin: 0.75rem 0 0;
    padding: 0;
}

.doc-nav .doc-nav {
    margin: 0.35rem 0 0.35rem 0.85rem;
    padding-left: 0.75rem;
    border-left: 1px solid var(--border);
}

.doc-nav-item a {
    display: block;
    padding: 0.35rem 0.45rem;
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.doc-nav-item.is-active > a,
.doc-nav-item a:hover {
    color: var(--text);
    background: rgba(175, 105, 11, 0.12);
}

.docs-content {
    min-width: 0;
    padding: 0.25rem 0 3rem;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
    line-height: 1.25;
    letter-spacing: -0.01em;
}

.markdown-body h1 {
    margin-top: 0;
    font-size: 2rem;
}

.markdown-body h2 {
    margin-top: 2rem;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid var(--border);
}

.markdown-body img.doc-thumb {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    object-fit: cover;
    border-radius: 16px;
    display: block;
    margin: 0;
    border: 0;
    background: transparent;
}

.references-layout > h1 {
    text-align: center;
    margin-bottom: 0.5rem;
}

.references-layout > p:first-of-type {
    text-align: center;
    max-width: 34rem;
    margin: 0 auto 2rem;
    color: var(--text-muted);
    font-size: 1.05rem;
}

.ref-grid {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    max-width: 36rem;
    margin: 0 auto;
}

.ref-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1.35rem 1.25rem 1.2rem;
    background: linear-gradient(165deg, rgba(36, 32, 28, 0.95), rgba(20, 17, 15, 0.98));
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.ref-card:hover {
    border-color: rgba(234, 191, 54, 0.45);
    transform: translateY(-3px);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.3);
}

.ref-card-art {
    width: 128px;
    height: 128px;
    padding: 3px;
    border-radius: 22px;
    background: linear-gradient(140deg, #af690b 0%, #eabf36 45%, #5b39ea 100%);
    box-shadow:
        0 0 0 1px rgba(255, 251, 237, 0.08) inset,
        0 10px 24px rgba(175, 105, 11, 0.25);
    margin: 0 0 1.25rem;
    flex-shrink: 0;
}

.ref-card h2 {
    margin: 0 0 1rem;
    padding: 0;
    border: 0;
    font-size: 1.35rem;
    color: var(--text);
}

.ref-card-body {
    width: 100%;
}

.ref-card-body > p {
    margin: 0 0 0.75rem;
    font-size: 0.95rem;
    line-height: 1.5;
}

.ref-card-body > ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

.ref-card-body li {
    margin: 0;
}

.ref-card-body li a {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    border-radius: 999px;
    border: 1px solid rgba(234, 191, 54, 0.35);
    background: rgba(175, 105, 11, 0.12);
    color: var(--accent-bright);
    text-decoration: none;
    font-size: 0.82rem;
    letter-spacing: 0.01em;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.ref-card-body li a:hover {
    background: rgba(234, 191, 54, 0.18);
    color: var(--text);
    border-color: rgba(234, 191, 54, 0.6);
}

.markdown-body p,
.markdown-body li {
    color: var(--text-secondary);
}

.markdown-body a {
    text-decoration: underline;
    text-underline-offset: 2px;
}

.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.25rem 0;
    font-size: 0.95rem;
}

.markdown-body th,
.markdown-body td {
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--border);
    text-align: left;
}

.markdown-body th {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
}

.markdown-body pre {
    overflow-x: auto;
    padding: 1rem;
    border-radius: 8px;
    background: #0a0807;
    border: 1px solid var(--border);
}

.markdown-body pre code {
    background: none;
    padding: 0;
}

.empty-state,
.nav-empty {
    color: var(--text-muted);
}

@media (max-width: 800px) {
    .docs-shell {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    .docs-sidebar {
        position: static;
    }
}
