:root {
    --bg: #fff;
    --surface: #fff;
    --surface-soft: #fafafa;
    --border: #e0e0e0;
    --border-strong: #ccc;
    --text: #222;
    --muted: #666;
    --heading: #000;
    --primary: #e65100;
    --primary-soft: #fff3e0;
    --success: #2e7d32;
    --shadow: none;
    --radius-lg: 0;
    --radius-md: 0;
    --radius-sm: 0;
    --content-width: 1000px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

@media (max-width: 640px) {
    html {
        font-size: 15px;
    }
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, sans-serif;
    color: var(--text);
    background: var(--bg);
    overflow-x: hidden;
}

body.no-scroll {
    overflow: hidden;
}

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

a:hover {
    text-decoration: underline;
}

img {
    max-width: 100%;
}

.page-shell {
    width: min(var(--content-width), calc(100% - 32px));
    margin: 0 auto;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.site-header-inner {
    width: min(var(--content-width), calc(100% - 16px));
    margin: 0 auto;
    min-height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 0 8px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--heading);
    font-weight: 700;
    flex-shrink: 0;
    text-decoration: none !important;
}

.brand img {
    width: 40px;
    height: 40px;
}

.brand-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.brand-text strong {
    font-size: clamp(0.9rem, 2vw, 1rem);
    line-height: 1.2;
}

.brand-text small {
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 6px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: var(--text);
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    -webkit-tap-highlight-color: transparent;
}

.menu-toggle svg {
    width: 24px;
    height: 24px;
}

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

.top-nav {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

@media (max-width: 768px) {
    .top-nav {
        position: absolute;
        top: 70px;
        left: 0;
        right: 0;
        flex-direction: column;
        gap: 0;
        background: rgba(245, 247, 251, 0.98);
        border-bottom: 1px solid rgba(219, 227, 241, 0.85);
        padding: 12px;
        display: none;
        flex-wrap: nowrap;
        justify-content: flex-start;
        max-height: calc(100vh - 70px);
        overflow-y: auto;
    }

    .top-nav.nav-open,
    .top-nav.active {
        display: flex;
    }
}

.top-nav a {
    padding: 10px 14px;
    border-radius: 0;
    color: var(--muted);
    font-weight: 500;
    white-space: nowrap;
    transition: none;
    min-height: 44px;
    display: flex;
    align-items: center;
}

@media (max-width: 768px) {
    .top-nav a {
        padding: 14px 16px;
        border-radius: 0;
        width: 100%;
        text-align: left;
        min-height: 48px;
    }
}

.top-nav a:hover,
.top-nav a.active {
    color: var(--primary);
    text-decoration: none;
}

.hero {
    padding: clamp(2rem, 5vw, 3.5rem) 0 clamp(1.5rem, 3vw, 2rem);
    height: fit-content;
}

.hero-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: clamp(1rem, 4vw, 2rem);
    align-items: stretch;
}

@media (max-width: 960px) {
    .hero-grid {
        grid-template-columns: 1fr;
    }
}

.hero-card,
.surface-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0;
    box-shadow: none;
}

.hero-card {
    padding: clamp(1.5rem, 5vw, 2.25rem);
}

.hero h1,
.page-intro h1 {
    margin: 0 0 16px;
    font-size: clamp(1.8rem, 5vw, 3.75rem);
    line-height: 1.1;
    color: var(--heading);
    word-break: break-word;
}

.hero p,
.page-intro p {
    margin: 0 0 18px;
    font-size: clamp(1rem, 2vw, 1.06rem);
    line-height: 1.7;
    color: var(--muted);
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: clamp(0.75rem, 2vw, 1rem);
    margin-top: 28px;
}

.button,
.button-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 1.25rem;
    border-radius: 0;
    font-weight: 600;
    transition: none;
    border: 1px solid var(--border);
    cursor: pointer;
    font-size: 0.9rem;
    text-decoration: none;
    flex-shrink: 0;
}

@media (max-width: 640px) {
    .button,
    .button-secondary {
        min-height: 44px;
        font-size: 0.95rem;
        flex-grow: 1;
        max-width: calc(50% - 0.5rem);
    }

    .button:only-of-type,
    .button-secondary:only-of-type {
        max-width: 100%;
    }
}

.button {
    color: #fff;
    background: var(--primary);
    border-color: var(--primary);
}

.button-secondary {
    color: var(--heading);
    background: #fff;
    border: 1px solid var(--border-strong);
}

.button:hover,
.button-secondary:hover {
    opacity: 0.85;
    text-decoration: none;
}

.button:active,
.button-secondary:active {
    transform: translateY(0);
}

.stats-card {
    padding: clamp(1.5rem, 4vw, 1.75rem);
    display: flex;
    flex-direction: column;
    gap: clamp(1rem, 2vw, 1.25rem);
}

.mini-kicker {
    color: var(--success);
    font-size: clamp(0.7rem, 1.5vw, 0.8rem);
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.stat-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: clamp(0.875rem, 2vw, 1rem);
}

@media (max-width: 640px) {
    .stat-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

.stat-item {
    padding: clamp(1rem, 2vw, 1rem);
    border-radius: 0;
    background: var(--surface-soft);
    border: 1px solid var(--border);
}

.stat-item strong {
    display: block;
    font-size: clamp(1.25rem, 3vw, 1.5rem);
    color: var(--heading);
}

.stat-item span {
    color: var(--muted);
    font-size: clamp(0.85rem, 1.5vw, 0.92rem);
    line-height: 1.5;
}

.section {
    padding: clamp(1rem, 3vw, 1.75rem) 0 clamp(1.5rem, 3vw, 2rem);
}

.section h2 {
    margin: 0 0 10px;
    font-size: clamp(1.5rem, 4vw, 1.9rem);
    color: var(--heading);
}

.section-lead {
    margin: 0 0 22px;
    color: var(--muted);
    line-height: 1.7;
    font-size: clamp(0.95rem, 1.5vw, 1rem);
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: clamp(1rem, 2vw, 1.125rem);
}

.card-grid.two-columns {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

@media (max-width: 640px) {
    .card-grid,
    .card-grid.two-columns {
        grid-template-columns: 1fr;
    }
}

.doc-card {
    padding: clamp(1.25rem, 3vw, 1.375rem);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0;
    box-shadow: none;
    transition: none;
}

.doc-card h3 {
    margin: 0 0 10px;
    color: var(--heading);
    font-size: clamp(1rem, 2vw, 1.125rem);
    word-break: break-word;
}

.doc-card p,
.doc-card li,
.content p,
.content li {
    color: var(--muted);
    line-height: 1.7;
    font-size: clamp(0.9rem, 1.5vw, 0.95rem);
}

.doc-card ul,
.content ul {
    margin: 0;
    padding-left: 20px;
}

@media (max-width: 640px) {
    .doc-card ul,
    .content ul {
        padding-left: 16px;
    }
}

.page-intro {
    padding: clamp(2rem, 4vw, 2.75rem) 16px clamp(0.5rem, 2vw, 0.5rem);
}

.page-layout {
    display: grid;
    grid-template-columns: minmax(200px, 260px) minmax(0, 1fr);
    gap: clamp(1.5rem, 3vw, 2rem);
    align-items: start;
    padding-bottom: clamp(2rem, 4vw, 3.5rem);
}

@media (max-width: 960px) {
    .page-layout {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

.sidebar {
    position: sticky;
    top: 90px;
    padding: clamp(1rem, 2vw, 1.25rem);
}

@media (max-width: 960px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(280px, 80vw);
        background: var(--surface);
        border-right: 1px solid var(--border);
        box-shadow: 4px 0 20px rgba(15, 23, 42, 0.15);
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 30;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 1.5rem 1rem;
    }

    .sidebar.sidebar-open {
        transform: translateX(0);
    }
}

.sidebar h2 {
    margin: 0 0 12px;
    font-size: clamp(0.9rem, 1.5vw, 1rem);
    color: var(--heading);
}

.sidebar-close {
    display: none;
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border: none;
    background: var(--surface-soft);
    color: var(--muted);
    border-radius: 50%;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.sidebar-close:hover {
    background: var(--border);
    color: var(--heading);
}

.sidebar-close:active {
    transform: scale(0.95);
}

@media (max-width: 960px) {
    .sidebar {
        padding-top: 3.5rem;
    }

    .sidebar-close {
        display: flex;
    }
}

.sidebar ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar a {
    display: block;
    padding: clamp(0.6rem, 1.5vw, 0.75rem) clamp(0.75rem, 1.5vw, 1rem);
    border-radius: 0;
    color: var(--muted);
    font-weight: 500;
    font-size: clamp(0.85rem, 1.5vw, 0.9rem);
    transition: none;
    word-break: break-word;
    min-height: 44px;
    display: flex;
    align-items: center;
}

@media (max-width: 960px) {
    .sidebar a {
        padding: 12px 16px;
        min-height: 48px;
        font-size: 1rem;
    }
}

.sidebar a:hover {
    background: var(--surface-soft);
    text-decoration: none;
    color: var(--primary);
}

.mobile-toc-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 48px;
    height: 48px;
    border-radius: 0;
    background: var(--primary);
    color: white;
    border: none;
    box-shadow: none;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 25;
    transition: none;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    -webkit-tap-highlight-color: transparent;
}

.mobile-toc-toggle svg {
    width: 28px;
    height: 28px;
}

.mobile-toc-toggle:hover {
    opacity: 0.85;
}

.mobile-toc-toggle:active {
    transform: scale(0.95);
}

@media (max-width: 960px) {
    .mobile-toc-toggle {
        display: flex;
    }
}

@media (max-width: 480px) {
    .mobile-toc-toggle {
        bottom: 16px;
        right: 16px;
        width: 52px;
        height: 52px;
    }

    .mobile-toc-toggle svg {
        width: 24px;
        height: 24px;
    }
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.4);
    z-index: 29;
    backdrop-filter: blur(2px);
}

.sidebar-overlay.active {
    display: block;
}

@media (min-width: 961px) {
    .mobile-toc-toggle,
    .sidebar-overlay {
        display: none !important;
    }
}

.content {
    display: flex;
    flex-direction: column;
    gap: clamp(1.25rem, 2vw, 1.5rem);
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
}

.content * {
    max-width: 100%;
}

.content-section {
    padding: clamp(1.5rem, 3vw, 1.625rem);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0;
}

.content-section h2 {
    margin: 0 0 10px;
    font-size: clamp(1.3rem, 3vw, 1.55rem);
    color: var(--heading);
    word-break: break-word;
}

.content-section h3 {
    margin: 22px 0 8px;
    color: var(--heading);
    font-size: clamp(1.05rem, 2vw, 1.2rem);
}

.kbd-inline,
.inline-code,
code {
    padding: 0.2rem 0.4rem;
    border-radius: 0;
    background: #f5f5f5;
    color: #333;
    font-size: clamp(0.8rem, 1.5vw, 0.92em);
    font-family: ui-monospace, monospace;
    word-break: break-word;
    display: inline-block;
}

pre {
    margin: 14px 0;
    padding: 1rem;
    overflow-x: auto;
    border-radius: 0;
    border: 1px solid var(--border);
    color: #222;
    background: #fafafa;
    font-family: ui-monospace, monospace;
    font-size: 0.9em;
    text-align: left;
    white-space: pre;
    word-spacing: normal;
    word-break: normal;
    word-wrap: normal;
    line-height: 1.5;
    tab-size: 4;
    hyphens: none;
    box-shadow: none;
    text-shadow: none;
    margin: 0 !important;
    -webkit-overflow-scrolling: touch;
    padding: 0.9em !important;
    background: #fafafa !important;
    border: 1px solid var(--border) !important;
    margin-bottom: 0.7em !important;
}

pre code {
    padding: 0;
    background: transparent;
    color: inherit;
	border: none;
	outline: none;
}

.preview {
    padding: clamp(1rem, 2vw, 1.375rem);
    border-radius: 0;
    border: 1px solid var(--border);
    background: #fafafa;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

@media (max-width: 640px) {
    .preview {
        padding: 12px;
        border-radius: 0;
    }
}

.preview-dark {
    background: #0f172a;
    border-style: solid;
}

.example-actions {
    display: flex;
    flex-wrap: wrap;
    gap: clamp(0.6rem, 1.5vw, 0.75rem);
    margin: 12px 0 18px;
}

@media (max-width: 640px) {
    .example-actions {
        gap: 8px;
    }

    .example-actions button,
    .example-actions a {
        flex: 1;
        min-width: 100px;
    }
}

.example-inline-preview {
    display: flex;
    flex-direction: column;
    gap: clamp(1rem, 2vw, 1rem);
}

.demo-board {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    border: 1px solid var(--border);
    border-radius: 0;
    background: #fff;
    padding: clamp(0.5rem, 1.5vw, 0.5rem);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.demo-board .sbolv {
    margin: 0;
}

.example-inline-preview .preview {
    min-height: 0;
}

.section-anchor-list {
    display: flex;
    flex-wrap: wrap;
    gap: clamp(0.6rem, 1.5vw, 0.75rem);
    margin-top: 14px;
}

.section-anchor-list a {
    padding: clamp(0.5rem, 1.5vw, 0.6rem) clamp(0.75rem, 1.5vw, 0.875rem);
    border-radius: 0;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--muted);
    font-weight: 500;
    font-size: clamp(0.8rem, 1.5vw, 0.9rem);
    transition: none;
    white-space: nowrap;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 640px) {
    .section-anchor-list a {
        min-height: 48px;
        padding: 12px 16px;
        flex: 1 1 auto;
        min-width: calc(50% - 6px);
    }
}

.section-anchor-list a:hover {
    background: var(--surface-soft);
    text-decoration: none;
    color: var(--primary);
}

.note,
.callout {
    padding: clamp(1rem, 2vw, 1.125rem) clamp(1rem, 2vw, 1.125rem);
    border-radius: 0;
    border: 1px solid var(--border);
    background: var(--surface-soft);
    color: var(--muted);
    font-size: clamp(0.9rem, 1.5vw, 0.95rem);
    line-height: 1.6;
}

.callout strong,
.note strong {
    color: var(--heading);
}

.reference-table {
    width: 100%;
    border-collapse: collapse;
    font-size: clamp(0.8rem, 1.5vw, 0.9rem);
}

.reference-table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
    .reference-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .reference-table thead {
        display: none;
    }

    .reference-table tbody {
        display: flex;
        flex-direction: column;
    }

    .reference-table tr {
        display: block;
        border-bottom: 2px solid var(--border);
        margin-bottom: 16px;
        padding: 12px 0;
    }

    .reference-table tr:last-child {
        border-bottom: none;
    }

    .reference-table td {
        display: block;
        padding: clamp(0.75rem, 2vw, 1rem) clamp(0.75rem, 2vw, 1rem);
        text-align: left;
        word-break: break-word;
        border-bottom: none !important;
    }

    .reference-table td:before {
        content: attr(data-label);
        font-weight: 700;
        color: var(--heading);
        display: block;
        margin-bottom: 8px;
        font-size: clamp(0.75rem, 1.5vw, 0.85rem);
    }

    .reference-table td:first-child {
        padding-top: 16px;
    }

    .reference-table td:last-child {
        padding-bottom: 16px;
    }
}

@media (min-width: 769px) {
    .reference-table th,
    .reference-table td {
        padding: clamp(1rem, 2vw, 1.25rem) clamp(1rem, 2vw, 1.5rem);
        border-bottom: 1px solid var(--border);
        text-align: left;
    }

    .reference-table th {
        font-size: clamp(0.8rem, 1.5vw, 0.9rem);
        letter-spacing: 0.04em;
        text-transform: uppercase;
        color: var(--muted);
    }
}

.reference-table .sbolv {
    margin: 0 !important;
    height: 75px !important;
    min-width: 100px !important;
}

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

.site-footer {
    padding: clamp(1.5rem, 3vw, 2rem) 0 clamp(2rem, 4vw, 3rem);
    color: var(--muted);
    font-size: clamp(0.85rem, 1.5vw, 0.95rem);
}

.site-footer-inner {
    width: min(var(--content-width), calc(100% - 16px));
    margin: 0 auto;
    padding: clamp(1rem, 2vw, 1.125rem) 8px 0;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    gap: clamp(1rem, 2vw, 1rem);
    flex-wrap: wrap;
}

@media (max-width: 640px) {
    .site-footer-inner {
        flex-direction: column;
        gap: 12px;
    }

    .site-footer-inner a {
        word-break: break-word;
    }
}

.hero-preview .preview {
    display: flex;
    align-items: center;
    justify-content: center;
}

.sbol-visual.small .sbolv {
    height: 80px;
    min-width: 35px;
}

.sbol-visual.big .sbolv {
    height: 150px;
    min-width: 60px;
}

.reference-symbol .sbolv {
    margin: 0 auto;
    height: 48px;
    min-width: 28px;
}

@media (max-width: 480px) {
    .page-shell {
        width: calc(100% - 12px);
        margin: 0 auto;
        padding: 0 6px;
    }

    .site-header-inner {
        width: calc(100% - 12px);
        margin: 0 auto;
        padding: 0 6px;
        min-height: 60px;
        gap: 12px;
    }

    .brand {
        gap: 10px;
    }

    .brand img {
        width: 32px;
        height: 32px;
    }

    .brand-text small {
        font-size: 10px;
    }

    .hero-card {
        border-radius: 0;
        padding: 1.25rem;
    }

    .content-section {
        border-radius: 0;
        padding: 1.25rem;
    }

    pre {
        border-radius: 0;
        font-size: 0.85rem;
    }

    .hero h1 {
        font-size: 1.75rem;
    }

    .stat-list {
        gap: 8px;
    }
}

@media (max-width: 960px) {
    .page-shell {
        width: min(var(--content-width), calc(100% - 24px));
        padding: 0 12px;
    }

    .site-header-inner {
        width: min(var(--content-width), calc(100% - 24px));
        padding: 0 12px;
    }

    .site-footer-inner {
        width: min(var(--content-width), calc(100% - 24px));
        padding-left: 12px;
        padding-right: 12px;
    }
}

@media (max-width: 640px) {
    .page-shell {
        width: calc(100% - 16px);
        padding: 0 8px;
    }

    .site-header-inner {
        width: calc(100% - 16px);
        padding: 0 8px;
        min-height: 60px;
    }

    .site-footer-inner {
        width: calc(100% - 16px);
        padding-left: 8px;
        padding-right: 8px;
    }

    .hero-card,
    .stats-card,
    .content-section,
    .doc-card {
        padding-left: clamp(1rem, 3vw, 1.25rem);
        padding-right: clamp(1rem, 3vw, 1.25rem);
    }

    .hero h1,
    .page-intro h1 {
        line-height: 1.15;
    }

    .note,
    .callout {
        padding: 14px 16px;
        font-size: 0.9rem;
    }

    img {
        height: auto;
        display: block;
    }

    .example-actions {
        gap: 8px;
    }

    .example-actions button,
    .example-actions a {
        flex: 1;
        min-width: 100px;
        min-height: 48px;
        font-size: 0.95rem;
    }
}
