:root {
    --docs-terminal: #07080d;
    --docs-terminal-panel: #10121a;
    --docs-terminal-border: rgba(255, 255, 255, .14);
    --docs-terminal-text: #eeeaff;
    --docs-terminal-muted: #a8a4b3;
    --docs-terminal-green: #67df9b;
    --docs-terminal-red: #ff8291;
}

html {
    scroll-behavior: smooth;
}

.docs-shell {
    padding-bottom: 5rem;
}

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

.docs-shell section,
.docs-hero-group {
    scroll-margin-top: 5rem;
}

@media (min-width: 769px) {
    .docs-content > section {
        width: calc(72% + 3rem + 2px);
    }
}

.docs-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 1.25rem;
}

.docs-grid article {
    min-width: 0;
}

.docs-grid article pre {
    margin: .75rem 0;
}

.auth-panel {
    align-items: center;
    display: grid;
    gap: 1.5rem;
    grid-template-columns: minmax(0, 1fr) auto;
}

.auth-panel h2 {
    margin-bottom: .35rem;
}

.auth-panel h3 {
    margin: .35rem 0;
}

.auth-actions,
.terminal-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
}

.auth-actions {
    justify-content: flex-end;
}

.auth-status {
    border: 1px solid var(--jkz-site-border, rgba(255, 255, 255, .14));
    border-radius: 999px;
    color: var(--jkz-site-muted, #c9c7d2);
    display: inline-flex;
    font-size: .82rem;
    font-weight: 700;
    padding: .55rem .75rem;
}

.auth-status[data-state="authenticated"] {
    border-color: rgba(73, 227, 109, .5);
    color: #7af094;
}

.auth-status[data-state="error"] {
    border-color: rgba(255, 107, 107, .55);
    color: #ff9898;
}

.secondary-button,
.try-button,
.run-button {
    border: 0;
    border-radius: 4px;
    cursor: pointer;
    font: inherit;
    font-size: .83rem;
    font-weight: 700;
    min-height: 38px;
    padding: .55rem .85rem;
}

.code-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin: 1rem 0 0;
}

.docs-content .code-tabs button {
    background: rgba(75, 75, 75, .9) !important;
    border: 1px solid rgba(255, 255, 255, .13) !important;
    border-radius: 4px;
    color: #dedbe7 !important;
    cursor: pointer;
    padding: .55rem .85rem;
}

.docs-content .code-tabs button[aria-selected="true"] {
    background: linear-gradient(135deg, var(--jkz-site-purple, #8b3dff), var(--jkz-site-purple-dark, #6f28e8)) !important;
    border-color: rgba(199, 167, 255, .6) !important;
    color: #fff !important;
}

.code-panel pre {
    margin-bottom: 0;
}

.search-box {
    display: grid;
    font-size: .88rem;
    font-weight: 700;
    gap: .5rem;
    margin-top: 1rem;
    max-width: 44rem;
}

.search-box input {
    font: inherit;
    padding: .7rem .8rem;
    width: 100%;
}

.endpoint-group {
    overflow: visible;
}

.group-heading {
    align-items: baseline;
    border-bottom: 1px solid var(--jkz-site-border-soft, rgba(255, 255, 255, .08));
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: .75rem;
}

.group-heading h2 {
    font-size: clamp(1.15rem, 1.6vw, 1.45rem);
    margin: 0;
    position: static;
}

.group-heading > span {
    color: var(--jkz-site-muted, #c9c7d2);
    font-size: .78rem;
    white-space: nowrap;
}

.endpoint-card {
    margin-bottom: .85rem;
    min-width: 0;
}

.endpoint-card:last-child {
    margin-bottom: 0;
}

.endpoint-card > header {
    align-items: flex-start;
    background: transparent;
    box-shadow: none;
    color: inherit;
    display: flex;
    font-size: 1rem;
    font-weight: 400;
    gap: 1rem;
    justify-content: space-between;
    padding: 0;
    position: static;
    top: auto;
    width: auto;
    z-index: auto;
}

.route-line {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
    min-width: 0;
}

.route-line > code {
    overflow-wrap: anywhere;
    white-space: normal;
}

.method,
.auth-badge {
    align-items: center;
    border-radius: 4px;
    display: inline-flex;
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .035em;
    line-height: 1;
    text-transform: uppercase;
    white-space: nowrap;
}

.method {
    justify-content: center;
    min-width: 3.1rem;
    padding: .42rem .5rem;
}

.method-get {
    background: rgba(48, 203, 151, .16);
    color: #6ae0b7;
}

.method-post {
    background: rgba(91, 142, 255, .18);
    color: #9abbff;
}

.method-put,
.method-patch {
    background: rgba(255, 184, 77, .17);
    color: #ffd080;
}

.method-delete {
    background: rgba(255, 89, 117, .17);
    color: #ff8ca0;
}

.auth-badge {
    border: 1px solid var(--jkz-site-border, rgba(255, 255, 255, .14));
    color: var(--jkz-site-muted, #c9c7d2);
    padding: .48rem .58rem;
}

.auth-keycloak {
    border-color: rgba(139, 61, 255, .55);
    color: #c8aaff;
}

.auth-optional {
    border-color: rgba(255, 184, 77, .42);
    color: #f4cc87;
}

.auth-game {
    border-color: rgba(73, 227, 109, .42);
    color: #83ed9b;
}

.endpoint-summary {
    line-height: 1.55;
    margin: 1rem 0;
}

.endpoint-meta {
    display: grid;
    gap: .75rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 0 0 1rem;
}

.endpoint-meta > div {
    background: rgba(4, 5, 9, .42);
    border: 1px solid var(--jkz-site-border-soft, rgba(255, 255, 255, .08));
    border-radius: 6px;
    min-width: 0;
    padding: .75rem;
}

.endpoint-meta dt {
    color: var(--jkz-site-text, #f8f7ff);
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: .06em;
    margin-bottom: .35rem;
    text-transform: uppercase;
}

.endpoint-meta dd {
    color: var(--jkz-site-muted, #c9c7d2);
    font-size: .84rem;
    line-height: 1.5;
    margin: 0;
    overflow-wrap: anywhere;
}

.endpoint-meta code {
    white-space: normal;
}

.docs-content .try-button[aria-expanded="true"] {
    box-shadow: 0 0 0 2px rgba(199, 167, 255, .25);
}

.api-console {
    align-items: center;
    background: rgba(0, 0, 0, .78);
    border: 0;
    border-radius: 0;
    display: flex;
    inset: 0;
    justify-content: center;
    margin: 0;
    overflow: auto;
    padding: 1rem;
    position: fixed;
    z-index: 4000;
}

.terminal-modal-open {
    overflow: hidden;
}

.terminal-dialog {
    background: var(--docs-terminal);
    border: 1px solid var(--docs-terminal-border);
    border-radius: 8px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .7);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    height: min(82vh, 58rem);
    height: min(82dvh, 58rem);
    max-height: calc(100vh - 2rem);
    max-height: calc(100dvh - 2rem);
    overflow: hidden;
    width: min(80vw, 96rem);
}

.terminal-titlebar {
    align-items: center;
    background: var(--docs-terminal-panel);
    border-bottom: 1px solid var(--docs-terminal-border);
    display: flex;
    gap: .75rem;
    padding: .8rem 1rem;
}

.terminal-titlebar strong {
    color: var(--docs-terminal-text);
    flex: 1;
    font-size: .88rem;
    overflow-wrap: anywhere;
}

.docs-content .terminal-close {
    align-items: center;
    background: transparent !important;
    border: 0 !important;
    border-radius: 4px;
    color: var(--docs-terminal-text) !important;
    cursor: pointer;
    display: inline-flex;
    flex: 0 0 2rem;
    font-size: 1.5rem;
    height: 2rem;
    justify-content: center;
    margin: -.35rem -.35rem -.35rem auto;
    padding: 0;
    width: 2rem;
}

.docs-content .terminal-close:hover,
.docs-content .terminal-close:focus-visible {
    background: rgba(255, 255, 255, .1) !important;
    outline: 1px solid rgba(255, 255, 255, .3);
}

.terminal-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    min-height: 0;
}

.terminal-request,
.terminal-output {
    display: grid;
    min-height: 0;
    min-width: 0;
}

.terminal-request {
    background: #0a0c12;
    grid-template-rows: auto minmax(0, 1fr);
}

.terminal-pane-heading {
    align-items: baseline;
    background: #151720;
    border-bottom: 1px solid var(--docs-terminal-border);
    display: flex;
    gap: .75rem;
    justify-content: space-between;
    min-height: 3rem;
    padding: .75rem 1rem;
}

.terminal-pane-heading strong {
    color: var(--docs-terminal-text);
    font-size: .88rem;
}

.terminal-pane-heading span {
    color: var(--docs-terminal-muted);
    font-size: .7rem;
    text-align: right;
}

.terminal-form {
    align-content: start;
    display: grid;
    gap: .85rem;
    grid-template-columns: 9rem minmax(0, 1fr);
    overflow: auto;
    padding: 1rem;
}

.terminal-form > label,
.terminal-form > .terminal-actions {
    display: grid;
    gap: .4rem;
    grid-column: 1 / -1;
}

.terminal-form > label:first-child {
    grid-column: 1;
}

.terminal-form > .path-field {
    grid-column: 2;
}

.terminal-form label > span {
    color: var(--docs-terminal-muted) !important;
    font-size: .74rem;
    font-weight: 700;
}

.terminal-form small {
    color: #777382 !important;
}

.terminal-form input,
.terminal-form select,
.terminal-form textarea {
    border-radius: 5px !important;
    font: inherit;
    padding: .62rem .7rem;
    width: 100%;
}

.terminal-form textarea,
.console-path,
.token-override input {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: .8rem;
    line-height: 1.5;
}

.terminal-form textarea {
    resize: vertical;
}

.path-field > div {
    align-items: stretch;
    display: flex;
    min-width: 0;
}

.path-field b {
    align-items: center;
    background: #181a24;
    border: 1px solid var(--docs-terminal-border);
    border-radius: 5px 0 0 5px;
    border-right: 0;
    color: var(--docs-terminal-muted);
    display: flex;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: .72rem;
    padding: 0 .7rem;
    white-space: nowrap;
}

.path-field input {
    border-radius: 0 5px 5px 0 !important;
    min-width: 0;
}

.file-field input {
    padding: .45rem;
}

.terminal-form > .terminal-actions {
    align-items: center;
    display: flex;
    flex-direction: row;
}

.run-button[disabled] {
    cursor: wait;
    opacity: .55;
}

.run-hint {
    color: var(--docs-terminal-muted);
    font-size: .73rem;
}

.terminal-output {
    background: #040509;
    border-left: 1px solid var(--docs-terminal-border);
    grid-template-rows: auto auto minmax(0, 1fr);
}

.response-meta {
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    color: var(--docs-terminal-muted);
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: .73rem;
    padding: .7rem 1rem;
}

.response-meta[data-ok="true"] {
    color: var(--docs-terminal-green);
}

.response-meta[data-ok="false"] {
    color: var(--docs-terminal-red);
}

.docs-content .terminal-output pre {
    background: transparent !important;
    border: 0 !important;
    border-radius: 0;
    margin: 0;
    max-height: none;
    min-height: 0;
    overflow: auto;
    padding: 0 !important;
}

.docs-content .terminal-output pre code {
    background: transparent !important;
    border: 0 !important;
    color: #c4d8c8;
    display: block;
    font-size: .8rem;
    line-height: 1.55;
    min-height: 5.5rem;
    padding: 1rem !important;
    white-space: pre;
}

.no-results {
    border-style: dashed !important;
    text-align: center;
}

[hidden] {
    display: none !important;
}

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

    .auth-panel {
        grid-template-columns: 1fr;
    }

    .auth-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 900px) {
    .terminal-dialog {
        height: calc(100vh - 2rem);
        height: calc(100dvh - 2rem);
        width: calc(100vw - 2rem);
    }

    .terminal-workspace {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(0, 1fr) minmax(14rem, .85fr);
    }

    .terminal-output {
        border-left: 0;
        border-top: 1px solid var(--docs-terminal-border);
    }
}

@media (max-width: 700px) {
    .api-console {
        align-items: stretch;
        padding: .5rem;
    }

    .terminal-dialog {
        height: calc(100vh - 1rem);
        height: calc(100dvh - 1rem);
        max-height: calc(100vh - 1rem);
        max-height: calc(100dvh - 1rem);
        width: calc(100vw - 1rem);
    }

    .endpoint-card > header,
    .group-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .endpoint-meta,
    .terminal-form {
        grid-template-columns: 1fr;
    }

    .terminal-form > label:first-child,
    .terminal-form > .path-field {
        grid-column: 1;
    }

    .path-field > div {
        display: grid;
    }

    .path-field b {
        border-bottom: 0;
        border-radius: 5px 5px 0 0;
        border-right: 1px solid var(--docs-terminal-border);
        min-height: 2.4rem;
    }

    .path-field input {
        border-radius: 0 0 5px 5px !important;
    }

    .terminal-form > .terminal-actions {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}
