:root {
    --max: 1100px;
    --bg: #f7fafc;
    --surface: #ffffff;
    --muted: #6b7280;
    --text: #1f2937;
    --primary: #2563eb;
    --primary-600: #1e40af;
    --accent: #06b6d4;
    --danger: #dc2626;
    --success: #059669;
    --border: #e6eef9;
    --glass: rgba(255, 255, 255, 0.6);
    --shadow: 0 8px 30px rgba(2, 6, 23, 0.06);
    --radius: 12px;
}

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

html,
body {
    height: 100%;
}

body {
    max-width: var(--max);
    margin: 0 auto;
    padding: 18px;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial;
    background: linear-gradient(180deg, #f8fbff 0%, var(--bg) 100%);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

ul{
    padding-left: 15px;
}

header.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 22px;
    position: relative;
    z-index: 20;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text);
}

.logo .mark {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: inline-block;
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.18);
}

.logo .brand {
    font-weight: 700;
    font-size: 1.05rem;
}

nav {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

nav a {
    text-decoration: none;
    color: var(--primary-600);
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.12s ease;
    font-weight: 600;
}

nav a:hover {
    background: rgba(37, 99, 235, 0.06);
    transform: translateY(-1px);
}

nav .inline-form {
    margin-left: 8px;
}

.container {
    width: 100%;
}

.card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 18px;
    margin: 12px 0;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.card h2,
.card h3 {
    margin-bottom: 8px;
    color: var(--text);
}

.muted {
    color: var(--muted);
    font-size: 1.2rem;
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    border: 1px solid #e6eef9;
    border-radius: 999px;
    font-size: 12px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.6), rgba(240, 247, 255, 0.4));
}

.row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.row>* {
    flex: 1;
    min-width: 260px;
}

input,
select,
button,
textarea {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid #d6e4ff;
    margin-bottom: 10px;
    margin-top: 5px;
    background: linear-gradient(180deg, #fff, #fbfdff);
    outline: none;
    font-size: 14px;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.08);
}

button {
    cursor: pointer;
}

.actions {
    display: flex;
    gap: 8px;
}

.error {
    color: var(--danger);
}

.success {
    color: var(--success);
}

.btn {
    display: inline-block;
    padding: 10px 14px;
    border-radius: 10px;
    background: var(--primary);
    color: white;
    text-decoration: none;
    border: none;
    font-weight: 700;
    line-height: 1.5 !important;
}

.btn-ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.btn.small {
    padding: 6px 10px;
    font-size: 13px;
}

.btn.danger {
    background: var(--danger);
}

.code {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 8px;
    background: #f8fafc;
    border: 1px solid #e6eef9;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, 'Roboto Mono', 'Courier New', monospace;
    font-size: 13px;
    word-break: break-all;
}

.tag {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 6px;
    background: rgba(6, 182, 212, 0.08);
    color: var(--accent);
    font-weight: 700;
}

table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    word-wrap: break-word;
    background: transparent;
}

th,
td {
    border: 1px solid #eef6ff;
    padding: 12px;
    text-align: left;
    font-size: 14px;
}

th {
    background: rgba(240, 247, 255, 0.6);
    font-weight: 700;
}

tr:nth-child(even) td {
    background: rgba(250, 252, 255, 0.6);
}

.card-index {
    background: linear-gradient(180deg, #ffffff, #fbfdff);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(20, 40, 80, 0.06);
    width: 100%;
    border: 1px solid #eef6ff;
}

.card-index h2 {
    margin: 0 0 0.5rem 0;
    color: #0f1724;
    font-size: 1.5rem;
}

.card-index .muted {
    color: var(--muted);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.card-index ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.card-index li {
    margin-bottom: 0.75rem;
}

.card-index li a {
    display: block;
    padding: 0.85rem 1.25rem;
    background: #f8fafc;
    color: #111827;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    border: 1px solid #eaf2ff;
    transition: all .15s ease;
}

.card-index li a:hover {
    transform: translateX(6px);
    background: #f1f5f9;
    color: var(--primary);
}

.dropzone-container {
    position: relative;
    width: 100%;
    min-height: 180px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px dashed rgba(37, 99, 235, 0.18);
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(240, 247, 255, 0.9), rgba(248, 252, 255, 0.7));
    transition: all 0.25s ease;
    cursor: pointer;
    text-align: center;
    overflow: hidden;
}

.dropzone-container.drag-over {
    background-color: rgba(34, 197, 94, 0.04);
    border-color: var(--primary-600);
    transform: translateY(-3px);
    box-shadow: 0 12px 40px rgba(37, 99, 235, 0.06);
}

.dropzone-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
}

.dropzone-hint {
    font-size: 0.95rem;
    color: var(--muted);
}

.dropzone-input {
    width: 130%;
    height: 110%;
    position: absolute;
    left: -73px;
    top: -10px;
    opacity: 0;
    cursor: pointer;
}

.dropzone-preview {
    margin-top: 12px;
    max-width: 100%;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.dropzone-preview img {
    max-width: 160px;
    max-height: 120px;
    border-radius: 8px;
    border: 1px solid #e6f0ff;
}

.dropzone-meta {
    font-size: 13px;
    color: var(--muted);
}

.pagination {
    margin: 24px 0;
    display: flex;
    justify-content: center;
}

.pagination ul {
    display: inline-flex;
    list-style: none;
    gap: 8px;
    padding: 6px;
    margin: 0;
    border-radius: 999px;
    background: #fff;
    border: 1px solid #e6effc;
}

.pagination li {
    display: flex;
}

.pagination a,
.pagination span {
    min-width: 38px;
    padding: 8px 14px;
    border-radius: 999px;
    text-decoration: none;
    color: var(--primary-600);
    font-weight: 600;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    transition: all .12s ease;
}

.pagination a:hover {
    background: rgba(37, 99, 235, 0.06);
}

.pagination li.active span {
    background: var(--primary-600);
    color: #fff;
    box-shadow: 0 6px 22px rgba(37, 99, 235, 0.2);
    cursor: default;
}

.grid {
    display: grid;
    gap: 12px;
}

.danger {
    background: linear-gradient(180deg, #fff5f5, #fff);
    border: 1px solid rgba(220, 38, 38, 0.08);
    color: var(--danger);
    padding: 10px 12px;
    border-radius: 8px;
}

.lang-switcher {
    display: flex;
    gap: 6px;
    align-items: center;
}

.lang-btn {
    background: transparent;
    border: 1px solid var(--border);
    padding: 6px 8px;
    border-radius: 8px;
    font-weight: 700;
    color: var(--primary-600);
    cursor: pointer;
    font-size: 13px;
}

.lang-btn.active {
    background: var(--primary-600);
    color: #fff;
    box-shadow: 0 6px 18px rgba(30, 64, 175, 0.18);
    border-color: rgba(30, 64, 175, 0.12);
}

.hamburger {
    display: none;
    background: transparent;
    border: none;
    padding: 6px;
    margin-left: 6px;
    cursor: pointer;
}

.hamburger:focus {
    outline: 2px solid rgba(37, 99, 235, 0.15);
    border-radius: 8px;
}

.hamburger-box {
    width: 24px;
    height: 16px;
    display: inline-block;
    position: relative;
}

.hamburger-inner {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background-color: var(--text);
    transform: translateY(-50%);
    transition: transform .2s ease, background-color .2s ease;
}

.hamburger-inner::before,
.hamburger-inner::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background-color: var(--text);
    transition: transform .2s ease, opacity .2s ease;
}

.hamburger-inner::before {
    top: -7px;
}

.hamburger-inner::after {
    bottom: -7px;
}

body.nav-open .hamburger-inner {
    background-color: transparent;
}

body.nav-open .hamburger-inner::before {
    transform: rotate(45deg) translate(5px, 5px);
}

body.nav-open .hamburger-inner::after {
    transform: rotate(-45deg) translate(5px, -5px);
}

.user-block {
    display: flex;
    gap: 8px;
    align-items: center;
}

.user-block {
    min-width: 0;
}

.user-block .muted {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 180px;
}

.user-block form {
    display: inline;
}

@media (max-width: 768px) {
    header.site-header {
        align-items: flex-start;
    }

    .hamburger {
        display: inline-flex;
    }

    header.site-header {
        position: relative;
    }

    #main-nav {
        position: absolute;
        left: 12px;
        right: 12px;
        top: calc(100% + 8px);
        display: flex;
        flex-direction: column;
        gap: 8px;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: 10px;
        padding: 8px;
        box-shadow: 0 12px 40px rgba(20, 40, 80, 0.06);
        opacity: 0;
        transform: translateY(-6px) scale(0.995);
        pointer-events: none;
        transition: opacity .18s ease, transform .18s ease, max-height .18s ease;
        max-height: 0;
        overflow: hidden;
        z-index: 18;
    }

    body.nav-open #main-nav {
        opacity: 1;
        transform: translateY(0) scale(1);
        pointer-events: auto;
        max-height: 60vh;
        overflow: auto;
    }

    .header-right {
        display: flex;
        gap: 8px;
        align-items: center;
        margin-top: 8px;
        width: 100%;
        justify-content: space-between;
        position: relative;
        z-index: 20;
        flex-wrap: wrap;
    }

    .header-right .lang-switcher {
        order: 0;
        margin-left: auto;
        margin-right: 0;
        align-self: center;
    }

    .header-right .user-block {
        order: 1;
        flex-shrink: 0;
        min-width: 0;
        width: 100%;
        display: flex;
        justify-content: right;
        align-items: center;
        gap: 8px;
    }

    .header-right .user-block .muted {
        max-width: 140px;
        text-align: center;
    }

    .header-right .user-block form {
        flex-shrink: 0;
    }

    .logo .brand {
        display: none;
    }

    nav {
        gap: 8px;
    }

    .row {
        flex-direction: column;
    }

    .lang-btn {
        padding: 8px 10px;
        font-size: 14px;
    }

    body.nav-open {
        overflow: hidden;
    }
}

@media (max-width: 640px) {
    body {
        padding: 12px;
    }

    .logo .brand {
        display: none;
    }

    nav {
        gap: 8px;
    }

    .row {
        flex-direction: column;
    }
}

/* ====== Tabs UI ====== */
.tab-buttons {
    display: inline-flex;
    gap: 8px;
    align-items: center;
}

.tab-button {
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--primary-600);
    font-weight: 700;
    cursor: pointer;
}

.tab-button:hover {
    transform: translateY(-2px);
}

.tab-button.active {
    background: linear-gradient(180deg, var(--primary), var(--primary-600));
    color: #fff;
    border-color: rgba(30, 64, 175, 0.12);
    box-shadow: 0 8px 28px rgba(30, 64, 175, 0.12);
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

.tab-panel h4 {
    margin-top: 8px;
}

.tab-panel ul {
    margin-left: 16px;
}

pre.code {
    display: block;
    padding: 10px;
    background: #fbfdff;
    border-radius: 8px;
    border: 1px solid #eef6ff;
    overflow: auto;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.checkbox-row .checkbox-label {
    font-size: 0.95rem;
    color: var(--text-color, #111);
    line-height: 1;
}

.checkbox-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    flex: 0 0 auto;
    accent-color: #0b76ef;
}

.dropzone-container.drag-over {
    outline: 2px dashed rgba(11, 118, 239, 0.6);
    background: rgba(11, 118, 239, 0.03);
}

@media (max-width: 640px) {
    .tab-buttons {
        width: 100%;
        justify-content: flex-end;
    }

    .tab-button {
        padding: 8px 10px;
        font-size: 13px;
    }
}

.spoiler {
    border: 1px solid rgba(230, 240, 255, 0.8);
    border-radius: 10px;
    overflow: visible;
    transition: box-shadow .18s ease, transform .12s ease;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.6), rgba(250, 252, 255, 0.8));
    margin-top: 10px;
}

.spoiler summary {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    cursor: pointer;
    font-weight: 700;
    color: var(--primary-600);
    border-bottom: 1px solid rgba(230, 240, 255, 0.6);
}

.spoiler summary::-webkit-details-marker {
    display: none;
}

.spoiler .summary-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.spoiler .summary-meta {
    color: var(--muted);
    font-weight: 600;
    font-size: 0.95rem;
}

.spoiler .spoiler-body {
    padding: 12px;
    display: grid;
    gap: 12px;
    grid-template-columns: 1fr;
    transition: max-height .28s ease, opacity .18s ease;
}

.spoiler .spoiler-body {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
}

.spoiler[open] .spoiler-body {
    max-height: none;
    opacity: 1;
    overflow: visible;
}

.spoiler-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.spoiler-tags .tag {
    background: rgba(6, 182, 212, 0.12);
    color: var(--accent);
    padding: 6px 10px;
    font-weight: 700;
    border-radius: 999px;
    font-size: 13px;
}

.spoiler-objects {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.spoiler-summary {
    color: var(--text);
    line-height: 1.5;
    font-size: 0.98rem;
}

.spoiler-keypoints {
    margin-left: 16px;
}

.spoiler-keypoints li {
    margin-bottom: 6px;
}

.spoiler-text {
    color: var(--text);
    line-height: 1.6;
    max-height: 220px;
    overflow: hidden;
    transition: max-height .22s ease;
    white-space: pre-wrap;
}

.spoiler-text.expanded {
    max-height: none;
}

.spoiler .spoiler-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    position: relative;
    z-index: 2;
}

@media (min-width: 720px) {
    .spoiler .spoiler-body {
        grid-template-columns: 1fr 320px;
    }

    .spoiler .spoiler-side {
        padding-left: 6px;
        border-left: 1px dashed rgba(230, 240, 255, 0.6);
    }
}

@media (max-width: 719px) {
    .spoiler summary {
        flex-direction: column;
        align-items: flex-start;
    }

    .spoiler .summary-meta {
        margin-top: 6px;
    }
}

.spoiler summary:focus {
    outline: 2px solid rgba(37, 99, 235, 0.14);
    border-radius: 8px;
}

.copy-feedback {
    font-size: 13px;
    color: var(--success);
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity .18s ease, transform .18s ease;
}

.copy-feedback.visible {
    opacity: 1;
    transform: translateY(0);
}

.dev-doc {
    margin-top: 10px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    padding-top: 12px;
}

.dev-spoiler {
    background: #fafafa;
    border: 1px solid #eee;
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 12px;
}

.dev-spoiler .summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.dev-spoiler .content {
    margin-top: 8px;
    display: none;
    max-height: 70vh;
    overflow: auto;
    white-space: pre-wrap;
    font-family: monospace;
    font-size: 13px;
}

.dev-spoiler .summary strong {
    width: 30%;
}

@media (max-width:600px) {
    .dev-spoiler .summary {
        flex-direction: column;
        align-items: flex-start;
    }

    .dev-spoiler .summary button {
        width: 100%;
    }

    .dev-spoiler .summary strong {
        width: 100%;
    }
}

.dev-spoiler .content {
    display: none;
}

.dev-spoiler .content.is-open {
    display: block;
}

.card h2, .card h3, .card h4, .card h5 {
    line-height: 1.25;
    letter-spacing: -0.01em;
}

.card p, .card li, .card div {
    line-height: 1.65;
    font-size: 1rem;
}

.muted {
    font-size: 0.98rem;
    line-height: 1.65;
}

.card-index section {
    margin-top: 14px;
}

.card-index h2 {
    letter-spacing: -0.02em;
    font-weight: 800;
}

.card-index h3 {
    margin-top: 10px;
    margin-bottom: 6px;
    font-weight: 800;
}

.card-index h4, .card-index h5 {
    margin-top: 10px;
    margin-bottom: 6px;
    font-weight: 800;
}

.card-index ul {
    margin-top: 10px;
    margin-left: 18px;
    list-style: disc;
}

.card-index li {
    margin-bottom: 8px;
}

.card-index a.btn {
    margin-right: 8px;
    margin-top: 10px;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 10px;
}

#tokens-overview table {
    table-layout: auto;
}

#tokens-overview td code {
    word-break: break-word;
    white-space: normal;
    font-size: 12px;
    padding: 6px 8px;
}

.link {
    text-decoration: none;
    color: var(--primary-600);
    padding: 8px 8px;
    border-radius: 8px;
    transition: all 0.12s ease;
    font-weight: 600;
}

.link:hover {
    background: rgba(37, 99, 235, 0.06);
}

@media (max-width: 640px) {
    #tokens-overview table {
        min-width: 0;
    }

    #tokens-overview thead {
        display: none;
    }

    #tokens-overview table,
    #tokens-overview tbody,
    #tokens-overview tr {
        display: block;
        width: 100%;
    }

    #tokens-overview tr {
        border: 1px solid #eef6ff;
        border-radius: 12px;
        margin-bottom: 12px;
        overflow: hidden;
        background: rgba(255,255,255,0.85);
        box-shadow: 0 10px 28px rgba(2, 6, 23, 0.04);
    }

    #tokens-overview td {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 10px;
        border: none;
        border-bottom: 1px solid #eef6ff;
        padding: 10px 12px;
        font-size: 14px;
    }

    #tokens-overview td:last-child {
        border-bottom: none;
    }

    #tokens-overview td::before {
        content: attr(data-label);
        font-weight: 800;
        color: #0f1724;
        flex: 0 0 40%;
        max-width: 40%;
    }

    #tokens-overview td > * {
        flex: 1;
        min-width: 0;
    }

    #tokens-overview td code {
        display: inline-block;
        max-width: 100%;
        overflow-wrap: anywhere;
    }

    .btn, 
    .link {
        width: 100% !important;
        display: block !important;
        text-align: center !important;
    }
}