:root {
    --bg: #FBFBFB;
    --text: #111;
    --text-secondary: #555;
    --text-tertiary: #999;
    --border: #E0E0E0;
    --border-light: #EBEBEB;
    --card-bg: #FFFFFF;

    --yes: #1a7a3a;
    --yes-bg: #f0f9f2;
    --no: #c43333;
    --no-bg: #fdf2f2;
    --refer: #946b00;
    --refer-bg: #fdf8ec;

    --transition: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
    font-size: clamp(16px, 0.5vw + 9px, 17px);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    position: relative;
}

/* ── Links ── */

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

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

/* ── Footer ── */

footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: var(--text-tertiary);
    letter-spacing: 0.01em;
    max-width: none;
    margin: 0;
    padding: 20px 60px;
}

.home ~ footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
}

.footer-copy {
    font-size: 11px;
    color: var(--text-tertiary);
    letter-spacing: 0.01em;
}

footer nav {
    display: flex;
    gap: 20px;
}

footer a {
    color: var(--text-tertiary);
    font-size: 11px;
    letter-spacing: 0.01em;
}

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

/* ── Home ── */

.home {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding-bottom: 50px;
    position: relative;
}

.home-canvas {
    position: relative;
    width: min(520px, 60vw);
    height: min(520px, 60vw, 50vh);
    margin-bottom: 40px;
}

.home-canvas canvas {
    width: 100%;
    height: 100%;
}

.home-entry {
    text-align: center;
}

.home-entry-title {
    font-size: clamp(14px, 0.5vw + 7px, 15px);
    font-weight: 400;
    color: var(--text-secondary);
    letter-spacing: 0.06em;
    margin-bottom: 6px;
}

.home-entry-desc {
    font-size: clamp(12px, 0.5vw + 5px, 13px);
    font-weight: 300;
    color: var(--text-tertiary);
    letter-spacing: 0.02em;
    margin-bottom: 24px;
}

.home-entry-nav {
    display: flex;
    gap: 20px;
    align-items: center;
    justify-content: center;
}

.home-entry-nav a {
    font-size: clamp(12px, 0.5vw + 5px, 13px);
    font-weight: 400;
    color: var(--text-tertiary);
    letter-spacing: 0.02em;
    transition: color 0.3s;
}

.home-entry-nav a:hover {
    color: var(--text-secondary);
}

.home-entry-sep {
    width: 1px;
    height: 10px;
    background: var(--border-light);
}

/* ── Legal pages ── */

.legal-back {
    position: absolute;
    top: 32px;
    left: 32px;
    font-size: clamp(14px, 0.5vw + 7px, 15px);
    color: var(--text-tertiary);
    transition: color 0.15s;
    z-index: 10;
}

.legal-back:hover {
    color: var(--text);
}

.legal {
    max-width: 600px;
    margin: 0 auto;
    padding: 120px 32px 80px;
    min-height: calc(100vh - 60px);
}

.legal-header {
    margin-bottom: 56px;
}

.legal-header h1 {
    font-size: clamp(13px, 0.5vw + 6px, 14px);
    font-weight: 400;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.legal-updated {
    font-size: 11px;
    font-weight: 300;
    color: var(--text-tertiary);
    letter-spacing: 0.02em;
    margin-top: 8px;
}

.legal section {
    margin-bottom: 24px;
}

.legal h2 {
    font-size: clamp(13px, 0.5vw + 6px, 14px);
    font-weight: 400;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.legal p {
    font-size: clamp(13px, 0.5vw + 6px, 14px);
    line-height: 1.8;
    color: var(--text-tertiary);
}

.legal p + p {
    margin-top: 12px;
}

.legal a {
    color: var(--text-secondary);
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-color: var(--border);
}

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

/* ── Documentation ── */

.docs {
    display: flex;
    max-width: 1200px;
    margin: 0 auto;
    height: 100vh;
}

.docs-side {
    width: 280px;
    flex-shrink: 0;
    padding: 0 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 48px;
}

.docs-back {
    position: fixed;
    top: 32px;
    left: 32px;
    font-size: clamp(14px, 0.5vw + 7px, 15px);
    color: var(--text-tertiary);
    transition: color 0.15s;
    z-index: 10;
}

.docs-back:hover {
    color: var(--text);
}

.docs-side-links {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.docs-side-links a {
    font-size: clamp(13px, 0.5vw + 6px, 14px);
    font-weight: 400;
    color: var(--text-tertiary);
    letter-spacing: 0.01em;
    transition: color 0.15s;
}

.docs-side-links a:hover {
    color: var(--text-secondary);
}

.docs-side-links a.active {
    color: var(--text);
}

.docs-main {
    flex: 1;
    padding: 0 60px 0 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.docs-section {
    display: none;
}

.docs-section.active {
    display: block;
}

.docs-section-title {
    display: none;
}

.docs-lead {
    font-size: clamp(16px, 0.5vw + 9px, 17px);
    line-height: 1.7;
    color: var(--text);
    margin-bottom: 20px;
    font-weight: 400;
}

.docs-main p {
    font-size: clamp(14px, 0.5vw + 7px, 15px);
    line-height: 1.75;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.docs-examples {
    display: grid;
    grid-template-columns: repeat(3, auto);
    justify-content: start;
    gap: 8px;
    margin: 24px 0 28px;
}

.docs-example {
    font-size: clamp(13px, 0.5vw + 6px, 14px);
    color: var(--text-secondary);
    padding: 8px 16px;
    border: 1px solid var(--border-light);
    border-radius: 2px;
    letter-spacing: 0.01em;
}

/* ── Docs: Lender grid ── */

.docs-lender-tabs {
    display: flex;
    gap: 24px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-light);
}

.docs-lender-tab {
    font-size: clamp(12px, 0.5vw + 5px, 13px);
    font-weight: 400;
    color: var(--text-tertiary);
    padding: 8px 0;
    border: none;
    background: none;
    cursor: pointer;
    border-bottom: 1.5px solid transparent;
    margin-bottom: -1px;
    transition: color 0.15s;
}

.docs-lender-tab:hover {
    color: var(--text-secondary);
}

.docs-lender-tab.active {
    color: var(--text);
    border-bottom-color: var(--text);
}

.docs-lender-grids {
    display: grid;
}

.docs-lender-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: min-content;
    gap: 2px;
    grid-area: 1 / 1;
    align-content: start;
    justify-items: center;
    visibility: hidden;
}

.docs-lender-grid.active {
    visibility: visible;
}

a.docs-lender-card {
    text-decoration: none;
    color: inherit;
}

.docs-lender-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 12px;
    text-align: center;
    border-radius: 6px;
    transition: opacity 0.15s;
}

a.docs-lender-card:hover {
    opacity: 0.75;
}

.docs-lender-card img {
    max-height: clamp(24px, 1vw + 10px, 28px);
    max-width: clamp(80px, 3vw + 30px, 96px);
    object-fit: contain;
}

.docs-lender-card span {
    font-size: clamp(10px, 0.4vw + 4px, 11px);
    color: var(--text-tertiary);
}

/* ── Docs footer override ── */

.docs ~ footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: none;
    z-index: 2;
}

/* ── Responsive ── */

@media (max-width: 768px) {
    .home-canvas {
        width: 70vw;
        height: 70vw;
        margin-bottom: 32px;
    }

    footer {
        flex-direction: column;
        gap: 8px;
        padding: 16px 20px;
        text-align: center;
    }

    .docs {
        flex-direction: column;
    }

    .docs {
        height: auto;
    }

    .docs-side {
        display: none;
    }

    .docs-main {
        padding: 48px 24px 60px;
    }

    .docs-section {
        display: block;
        margin-bottom: 48px;
    }

    .docs-section-title {
        display: block;
        font-size: 13px;
        font-weight: 400;
        letter-spacing: 0.06em;
        color: var(--text-secondary);
        text-transform: uppercase;
        margin-bottom: 16px;
    }

    .docs ~ footer {
        position: static;
        padding-left: 20px;
    }

    .docs-lender-grid {
        grid-template-columns: repeat(2, 1fr);
    }

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

    .legal-back,
    .docs-back {
        display: none;
    }

    .legal {
        padding: 80px 24px 60px;
    }
}
