.nt-code-shell {
    --nt-code-bg: #0d1117;
    --nt-code-border: rgba(240, 246, 252, 0.12);
    position: relative;
    width: 100%;
    margin: 2.4rem 0;
    overflow: hidden;
    color: #e6edf3;
    background: var(--nt-code-bg);
    border: 1px solid var(--nt-code-border);
    border-radius: 14px;
    corner-shape: squircle;
}

.nt-code-toolbar {
    display: flex;
    min-height: 42px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 10px 0 16px;
    color: #8b949e;
    background: #161b22;
    border-bottom: 1px solid var(--nt-code-border);
    font: 600 12px/1 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.nt-code-language {
    overflow: hidden;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
    letter-spacing: 0.08em;
}

.nt-code-copy,
.nt-code-toggle {
    appearance: none;
    border: 0;
    font: 600 13px/1 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    cursor: pointer;
}

.nt-code-copy {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 32px;
    padding: 0 9px;
    color: #c9d1d9;
    background: transparent;
    border-radius: 8px;
}

.nt-code-copy:hover,
.nt-code-copy:focus-visible {
    color: #fff;
    background: rgba(240, 246, 252, 0.08);
}

.nt-code-copy:focus-visible,
.nt-code-toggle:focus-visible {
    outline: 2px solid #58a6ff;
    outline-offset: 2px;
}

.nt-code-copy svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.nt-code-viewport {
    position: relative;
    transition: max-height 220ms ease;
}

.nt-code-shell pre,
.gh-content .nt-code-shell pre {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 20px;
    overflow: auto;
    color: #e6edf3;
    background: var(--nt-code-bg);
    border: 0;
    border-radius: 0;
    tab-size: 4;
}

.nt-code-shell code,
.gh-content .nt-code-shell code {
    padding: 0;
    color: inherit;
    background: transparent;
    font: 13.5px/1.65 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    white-space: pre;
}

.nt-code-shell.is-collapsible.is-collapsed .nt-code-viewport {
    max-height: 26rem;
    overflow: hidden;
}

.nt-code-shell.is-collapsible.is-collapsed .nt-code-viewport::after {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 96px;
    pointer-events: none;
    box-shadow: inset 0 -72px 44px -38px rgba(0, 0, 0, 0.98);
    content: "";
}

.nt-code-toggle {
    position: absolute;
    z-index: 2;
    right: 50%;
    bottom: 14px;
    display: none;
    min-height: 36px;
    padding: 0 14px;
    color: #f0f6fc;
    background: #21262d;
    border: 1px solid rgba(240, 246, 252, 0.18);
    border-radius: 9px;
    transform: translateX(50%);
}

.nt-code-shell.is-collapsible .nt-code-toggle {
    display: block;
}

.nt-code-shell.is-collapsible:not(.is-collapsed) .nt-code-toggle {
    position: relative;
    right: auto;
    bottom: auto;
    margin: 0 auto 14px;
    transform: none;
}

@media (max-width: 600px) {
    .nt-code-shell pre,
    .gh-content .nt-code-shell pre {
        padding: 16px;
    }

    .nt-code-shell code,
    .gh-content .nt-code-shell code {
        font-size: 12.5px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .nt-code-viewport {
        transition: none;
    }
}
