/* API console — light theme (use with ../theme.css + dashboard.css) */
html[data-theme="light"] body.api-console {
    color-scheme: light;
    --black: #f4f4f6;
    --black-muted: #e6e6ea;
    --black-elevated: #ececee;
    --surface: #e2e2e8;
    --surface-up: #d8d8df;
    --white: #0c0c0e;
    --gray: #5c5d66;
    --gray-dim: #6a6a72;
    --orange: #e04000;
    --accent: #e04000;
    --accent-bright: #ff4500;
    --accent-hover: #c73700;
    --accent-muted: rgba(224, 64, 0, 0.14);
    --orange-glow: rgba(224, 64, 0, 0.15);
    --grid-line: rgba(12, 12, 14, 0.14);
    --border-muted: rgba(12, 12, 14, 0.08);
}

html[data-theme="light"] .api-grid-bg {
    background-image:
        linear-gradient(to right, rgba(12, 12, 14, 0.08) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(12, 12, 14, 0.08) 1px, transparent 1px);
    opacity: 0.45;
}

html[data-theme="light"] .api-wave {
    background: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 5px,
        rgba(12, 12, 14, 0.07) 5px,
        rgba(12, 12, 14, 0.07) 6px
    );
}

/* Theme control: orange icon, no filled hover (matches landing) */
.api-icon-btn.theme-toggle svg {
    width: 20px;
    height: 20px;
}

button.api-icon-btn.theme-toggle:hover,
button.api-icon-btn.theme-toggle:focus-visible {
    background: transparent;
    color: var(--orange);
}

button.api-icon-btn.theme-toggle:focus-visible {
    outline: 2px solid var(--orange);
    outline-offset: 2px;
}

html[data-theme="light"] .api-icon-btn.theme-toggle:hover,
html[data-theme="light"] .api-icon-btn.theme-toggle:focus-visible {
    color: var(--orange);
}

html[data-theme="light"] .api-hero-heading__shine {
    filter: drop-shadow(0 0 10px rgba(224, 64, 0, 0.35));
}

/* Supabase auth (header + login) */
.api-header-auth {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: 0.25rem;
}

.api-auth-signin {
    font-size: 0.75rem;
    color: var(--gray);
    text-decoration: none;
    padding: 0.35rem 0.6rem;
    border-radius: 6px;
    border: 1px solid var(--grid-line);
}

.api-auth-signin:hover {
    color: var(--orange);
    border-color: var(--orange);
}

.api-auth-signed {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.api-auth-signed[hidden] {
    display: none !important;
}

.api-auth-signin[hidden] {
    display: none !important;
}

.api-auth-out {
    font-size: 0.7rem;
    background: transparent;
    border: 1px solid var(--grid-line);
    color: var(--gray);
    border-radius: 6px;
    padding: 0.3rem 0.5rem;
    cursor: pointer;
}

.api-auth-out:hover {
    color: var(--orange);
    border-color: var(--orange);
}

.api-login-wrap {
    max-width: 28rem;
}

.api-login-tabs {
    display: flex;
    gap: 0.5rem;
    margin: 1.25rem 0 1rem;
}

.api-login-tab {
    background: transparent;
    border: 1px solid var(--grid-line);
    color: var(--gray);
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.75rem;
}

.api-login-tab.is-active {
    color: var(--orange);
    border-color: var(--orange);
}

.api-login-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.api-form-label {
    font-size: 0.7rem;
    color: var(--gray-dim);
}

.api-login-submit {
    margin-top: 0.5rem;
    align-self: flex-start;
}

.api-login-error {
    color: var(--accent);
    font-size: 0.75rem;
    margin: 0 0 0.75rem;
}

.api-login-hint {
    margin-top: 1.5rem;
    font-size: 0.65rem;
    color: var(--gray-dim);
    line-height: 1.5;
}

.api-login-hint code {
    font-size: 0.65rem;
}

/* API keys — themed modal (replaces window.alert / prompt) */
.api-modal {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    box-sizing: border-box;
}

.api-modal[hidden] {
    display: none !important;
}

.api-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 5, 5, 0.72);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: none;
    padding: 0;
    cursor: pointer;
}

html[data-theme="light"] .api-modal__backdrop {
    background: rgba(12, 12, 14, 0.45);
}

.api-modal__panel {
    position: relative;
    width: 100%;
    max-width: 26rem;
    max-height: min(90vh, 32rem);
    overflow: auto;
    padding: 1.35rem 1.35rem 1.15rem;
    border-radius: var(--radius);
    border: 1px solid var(--grid-line);
    background: var(--black-elevated);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

html[data-theme="light"] .api-modal__panel {
    background: var(--black-elevated);
    box-shadow: 0 24px 60px rgba(12, 12, 14, 0.12);
}

.api-modal__title {
    margin: 0 0 0.85rem;
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--white);
    line-height: 1.25;
}

.api-modal__body {
    font-size: 0.8125rem;
    line-height: 1.5;
    color: var(--gray);
}

.api-modal__body p {
    margin: 0 0 0.75rem;
}

.api-modal__body p:last-child {
    margin-bottom: 0;
}

.api-modal__field {
    margin-top: 0.35rem;
}

.api-modal__label {
    display: block;
    font-family: 'Space Mono', ui-monospace, monospace;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--gray-dim);
    margin-bottom: 0.35rem;
}

.api-modal__input {
    width: 100%;
    padding: 0.5rem 0.65rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--grid-line);
    background: var(--surface);
    color: var(--white);
    font-family: 'Space Mono', ui-monospace, monospace;
    font-size: 0.75rem;
    box-sizing: border-box;
}

.api-modal__input:focus {
    outline: none;
    border-color: var(--orange);
    box-shadow: 0 0 0 2px var(--accent-muted);
}

.api-modal__key-box {
    margin-top: 0.65rem;
    padding: 0.65rem 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--grid-line);
    background: var(--surface);
    font-family: 'Space Mono', ui-monospace, monospace;
    font-size: 0.7rem;
    word-break: break-all;
    color: var(--white);
    line-height: 1.45;
}

.api-modal__footer {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 1.15rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-muted);
}

.api-modal__msg--error {
    color: var(--orange);
    font-size: 0.8125rem;
}

/* Models page: copy model id */
.api-model-name-cell {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
    width: 100%;
    justify-content: flex-start;
}

.api-model-name-text {
    flex: 0 1 auto;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.api-model-copy-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 1.75rem;
    height: 1.75rem;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--gray-dim);
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease;
}

.api-model-copy-btn:hover {
    color: var(--white);
    background: var(--surface);
}

.api-model-copy-btn:focus-visible {
    outline: 2px solid var(--orange);
    outline-offset: 1px;
}

.api-model-copy-btn.is-copied {
    color: var(--accent-bright);
    background: var(--accent-muted);
}

html[data-theme="light"] .api-model-copy-btn.is-copied {
    color: var(--orange);
}

/* Pricing page */
.api-pricing-intro a {
    color: var(--gray);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.api-pricing-intro a:hover {
    color: var(--accent-bright);
}

.api-pricing-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.25rem;
    align-items: stretch;
    margin-bottom: 2rem;
}

.api-pricing-card {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 1.65rem 1.4rem 1.4rem;
    border-radius: var(--radius);
    border: 1px solid var(--grid-line);
    background: var(--surface);
    transition: transform 0.2s ease, box-shadow 0.25s ease, border-color 0.2s ease;
}

.api-pricing-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
    border-color: rgba(244, 244, 245, 0.14);
}

/* Featured: solid orange fill + white copy (not a soft tint on grey) */
.api-pricing-card--featured {
    border-color: rgba(255, 255, 255, 0.22);
    background: linear-gradient(165deg, var(--accent-bright) 0%, var(--orange) 42%, var(--accent-hover) 100%);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.12),
        0 20px 48px rgba(255, 69, 0, 0.35);
}

.api-pricing-card--featured:hover {
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.2),
        0 26px 56px rgba(255, 69, 0, 0.45);
}

.api-pricing-card--featured .api-pricing-name {
    color: rgba(255, 255, 255, 0.78);
}

.api-pricing-card--featured .api-pricing-tagline {
    color: #fff;
}

.api-pricing-card--featured .api-pricing-amount {
    color: #fff;
}

.api-pricing-card--featured .api-pricing-unit {
    color: rgba(255, 255, 255, 0.78);
}

.api-pricing-card--featured .api-pricing-credits {
    color: #fff;
}

.api-pricing-card--featured .api-pricing-credits-was {
    color: rgba(255, 255, 255, 0.55);
}

.api-pricing-card--featured .api-pricing-credits-now {
    color: #fff;
}

.api-pricing-card--featured .api-pricing-eq {
    color: rgba(255, 255, 255, 0.88);
}

.api-pricing-card--featured .api-pricing-features li {
    color: rgba(255, 255, 255, 0.95);
}

.api-pricing-card--featured .api-pricing-features li::before {
    background: #fff;
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.45);
}

.api-pricing-card--featured .api-pricing-cta.api-btn-primary {
    background: #fff;
    color: var(--orange);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
}

.api-pricing-card--featured .api-pricing-cta.api-btn-primary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.95);
    color: var(--accent-hover);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
}

.api-pricing-ribbon {
    position: absolute;
    top: 0.85rem;
    right: 1rem;
    font-size: 0.55rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent-bright);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    background: var(--accent-muted);
    border: 1px solid rgba(255, 69, 0, 0.35);
}

.api-pricing-card--featured .api-pricing-ribbon {
    color: var(--orange);
    background: #fff;
    border: 1px solid rgba(255, 255, 255, 0.85);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.api-pricing-card-top {
    margin-bottom: 1rem;
}

.api-pricing-name {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--gray);
    margin-bottom: 0.35rem;
}

.api-pricing-tagline {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--white);
    letter-spacing: -0.02em;
}

.api-pricing-price {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.35rem;
}

.api-pricing-amount {
    font-size: clamp(2rem, 4vw, 2.35rem);
    font-weight: 500;
    letter-spacing: -0.04em;
    color: var(--white);
}

.api-pricing-unit {
    font-family: 'Space Mono', ui-monospace, monospace;
    font-size: 0.65rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--gray-dim);
}

.api-pricing-credits {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--white);
    margin-bottom: 0.25rem;
}

.api-pricing-credits-block {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    margin-bottom: 0.35rem;
}

.api-pricing-credits-was {
    display: block;
    font-size: 0.78rem;
    color: var(--gray-dim);
    text-decoration: line-through;
    text-decoration-thickness: 1px;
}

.api-pricing-credits-now {
    display: block;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--white);
    letter-spacing: -0.02em;
}

.api-pricing-eq {
    margin: 0 0 1.15rem;
    font-size: 0.62rem;
    color: var(--gray-dim);
    line-height: 1.4;
}

.api-pricing-features {
    margin: 0 0 1.35rem;
    padding: 0;
    list-style: none;
    flex: 1;
}

.api-pricing-features li {
    position: relative;
    padding-left: 1.15rem;
    margin-bottom: 0.55rem;
    font-size: 0.8125rem;
    color: var(--gray);
    line-height: 1.45;
}

.api-pricing-features li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.45em;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-bright), rgba(255, 69, 0, 0.45));
    box-shadow: 0 0 8px rgba(255, 69, 0, 0.35);
}

.api-pricing-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    text-align: center;
    text-decoration: none;
    box-sizing: border-box;
    margin-top: auto;
}

.api-pricing-footnote a {
    color: var(--gray);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.api-pricing-footnote a:hover {
    color: var(--accent-bright);
}

html[data-theme="light"] .api-pricing-card:hover {
    box-shadow: 0 18px 48px rgba(12, 12, 14, 0.1);
}

@media (max-width: 960px) {
    .api-pricing-grid {
        grid-template-columns: 1fr;
        max-width: 22rem;
        margin-left: auto;
        margin-right: auto;
    }

    .api-pricing-card--featured {
        order: -1;
    }
}

/* Usage page: section titles above bordered tables (not inside the border) */
.api-usage-table-section {
    margin-top: 1.75rem;
}

.api-usage-table-section:first-of-type {
    margin-top: 1.5rem;
}

.api-usage-section-title {
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.3;
    margin: 0 0 1rem;
    padding: 0;
    color: var(--white);
}

.api-usage-table-foot {
    font-size: 0.65rem;
    color: var(--gray-dim);
    line-height: 1.45;
    margin: 0;
    padding: 0.75rem 1rem 0.85rem;
}

/* Usage page: daily request bars + hover crosshair + tooltip */
.api-usage-chart {
    border-radius: var(--radius-sm);
    border: 1px solid var(--grid-line);
    background: linear-gradient(180deg, #101010 0%, var(--black) 100%);
    padding: 3.25rem 0.5rem 0.5rem;
    min-height: 220px;
    display: flex;
    flex-direction: column;
    overflow: visible;
}

.api-usage-bars {
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    gap: 1px;
    flex: 1;
    min-height: 150px;
    overflow: visible;
    position: relative;
}

.api-usage-bar__hit {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-end;
    position: relative;
    cursor: crosshair;
}

.api-usage-bar__hit:hover {
    z-index: 4;
}

.api-usage-bar__track {
    position: relative;
    flex: 1;
    min-height: 140px;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: stretch;
}

.api-usage-bar__crosshair {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 1px;
    transform: translateX(-50%);
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.05),
        rgba(255, 180, 120, 0.55) 45%,
        rgba(255, 69, 0, 0.5) 100%
    );
    box-shadow: 0 0 10px rgba(255, 69, 0, 0.35);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.14s ease;
    z-index: 2;
}

.api-usage-bar__hit:hover .api-usage-bar__crosshair {
    opacity: 1;
}

.api-usage-bar__tip {
    position: absolute;
    left: 50%;
    bottom: 100%;
    transform: translate(-50%, -10px);
    padding: 0.45rem 0.65rem 0.5rem;
    border-radius: 8px;
    border: 1px solid var(--grid-line);
    background: var(--surface);
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.55);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.14s ease, visibility 0.14s;
    pointer-events: none;
    z-index: 6;
    min-width: 10.5rem;
    max-width: min(14rem, 40vw);
}

.api-usage-bar__hit:hover .api-usage-bar__tip {
    opacity: 1;
    visibility: visible;
}

.api-usage-bar__tip-date {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--white);
    letter-spacing: 0.02em;
    margin-bottom: 0.2rem;
}

.api-usage-bar__tip-meta {
    font-size: 0.62rem;
    font-family: "Space Mono", ui-monospace, monospace;
    color: var(--gray);
    line-height: 1.35;
}

.api-usage-bar__fill {
    width: 100%;
    min-height: 3px;
    border-radius: 2px 2px 0 0;
    background: linear-gradient(180deg, rgba(255, 69, 0, 0.5), rgba(255, 69, 0, 0.14));
    transition: filter 0.14s ease, opacity 0.14s ease;
    flex-shrink: 0;
    position: relative;
    z-index: 3;
}

.api-usage-bar__hit:hover .api-usage-bar__fill {
    filter: brightness(1.2) saturate(1.05);
}

.api-usage-bar__label {
    font-size: 0.55rem;
    color: var(--gray-dim);
    margin-top: 0.35rem;
    font-family: "Space Mono", ui-monospace, monospace;
    white-space: nowrap;
    text-align: center;
    flex-shrink: 0;
}

html[data-theme="light"] .api-usage-chart {
    background: var(--black-muted);
}

html[data-theme="light"] .api-usage-bar__tip {
    box-shadow: 0 10px 28px rgba(12, 12, 14, 0.18);
}

/* Billing page — account strip + spend chart */
.api-billing-account--row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.5rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--grid-line);
    border-radius: var(--radius, 8px);
    background: var(--surface);
    margin-bottom: 1rem;
    max-width: 720px;
    font-size: 0.78rem;
    line-height: 1.4;
}

.api-billing-account__cell {
    min-width: min(100%, 14rem);
}

.api-billing-account-label {
    color: var(--gray);
    margin-right: 0.35rem;
}

.api-billing-chart-caption {
    font-size: 0.65rem;
    color: var(--gray);
    margin: 0 0 0.4rem;
    font-family: "Space Mono", ui-monospace, monospace;
}

.api-billing-wallet-note {
    font-size: 0.65rem;
    color: var(--gray-dim);
    margin: 0.5rem 0 0;
    line-height: 1.45;
}

.api-billing-spend-visual {
    height: 160px;
    border-radius: var(--radius-sm, 6px);
    border: 1px solid var(--grid-line);
    background: linear-gradient(180deg, #101010 0%, var(--black) 100%);
    padding: 0.5rem 0.4rem 0.35rem;
    box-sizing: border-box;
}

.api-billing-chart-bars {
    display: flex;
    align-items: flex-end;
    justify-content: stretch;
    gap: 2px;
    height: 100%;
    min-height: 120px;
}

.api-billing-bar__hit {
    flex: 1 1 0;
    min-width: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: stretch;
}

.api-billing-bar__fill {
    width: 100%;
    min-height: 2px;
    border-radius: 2px 2px 0 0;
    background: linear-gradient(180deg, rgba(94, 234, 212, 0.45), rgba(94, 234, 212, 0.12));
}

html[data-theme="light"] .api-billing-spend-visual {
    background: var(--black-muted);
}

html[data-theme="light"] .api-billing-bar__fill {
    background: linear-gradient(180deg, rgba(13, 148, 136, 0.5), rgba(13, 148, 136, 0.15));
}

/* --- Chat playground (chat.html) — AI Studio–style layout --- */
body[data-api-page="chat"] .api-content--playground {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}

.api-playground {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
    border-top: 1px solid var(--grid-line);
}

.api-playground__chat {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    background: var(--black);
}

.api-playground__toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--grid-line);
    background: var(--black);
}

.api-playground__toolbar-left,
.api-playground__toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem 1rem;
    flex-wrap: wrap;
}

.api-playground__title {
    font-size: 0.75rem;
    color: var(--gray);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.api-playground__status {
    font-size: 0.7rem;
    color: var(--gray-dim);
}

.api-playground__tokens {
    font-size: 0.7rem;
    color: var(--gray);
}

.api-playground__thread-wrap {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    position: relative;
}

.api-playground__thread {
    flex: 1;
    min-height: 12rem;
    overflow-y: auto;
    padding: 1rem 1.25rem;
    -webkit-overflow-scrolling: touch;
}

.api-playground__empty {
    font-size: 0.8rem;
    color: var(--gray-dim);
    line-height: 1.5;
    max-width: 28rem;
}

.api-playground__msg {
    margin-bottom: 1.1rem;
    max-width: 52rem;
}

.api-playground__msg-role {
    display: block;
    font-size: 0.65rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--gray-dim);
    margin-bottom: 0.35rem;
}

.api-playground__msg-body {
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--white);
    white-space: pre-wrap;
    word-break: break-word;
}

.api-playground__msg--user .api-playground__msg-body {
    padding: 0.55rem 0.85rem;
    border-radius: 1rem;
    border: 1px solid var(--grid-line);
    background: var(--surface);
}

.api-playground__msg--assistant .api-playground__msg-body {
    padding: 0.15rem 0;
}

.api-playground__msg--error {
    font-size: 0.8rem;
    line-height: 1.45;
    color: #ff8a66;
    padding: 0.65rem 0.75rem;
    border-radius: var(--radius);
    border: 1px solid rgba(255, 69, 0, 0.35);
    background: rgba(255, 69, 0, 0.08);
}

.api-playground__msg--error strong {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.65rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent-bright);
}

.api-playground__composer-wrap {
    --pg-shell-bg: var(--black-muted);
    --pg-shell-border: rgba(244, 244, 245, 0.1);
    --pg-chip-bg: var(--surface);
    --pg-chip-border: rgba(244, 244, 245, 0.1);
    --pg-send-fg: #050505;
    --pg-send-bg: #f4f4f5;
    border-top: 1px solid var(--grid-line);
    padding: 0.85rem 1rem 1rem;
    background: var(--black);
}

.api-playground__composer-shell {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    max-width: 56rem;
    margin: 0 auto;
    padding: 0.4rem 0.45rem 0.4rem 0.65rem;
    min-height: 3rem;
    box-sizing: border-box;
    border-radius: 999px;
    border: 1px solid var(--pg-shell-border);
    background: var(--pg-shell-bg);
    box-shadow:
        0 1px 0 rgba(0, 0, 0, 0.35),
        inset 0 1px 0 rgba(244, 244, 245, 0.04);
}

.api-playground__composer-model {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

/* Author `display: flex` wins over the default [hidden] rule; force remove from layout. */
.api-playground__composer-model[hidden] {
    display: none !important;
}

.api-playground__model-select {
    appearance: none;
    -webkit-appearance: none;
    max-width: 11rem;
    margin: 0;
    padding: 0.5rem 1.85rem 0.5rem 0.85rem;
    font-family: "Space Mono", ui-monospace, monospace;
    font-size: 0.6875rem;
    line-height: 1.25;
    letter-spacing: -0.02em;
    color: var(--white);
    background-color: var(--pg-chip-bg);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a8a93' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 11px;
    border: 1px solid var(--pg-chip-border);
    border-radius: 999px;
    cursor: pointer;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

.api-playground__model-select:hover {
    border-color: rgba(244, 244, 245, 0.16);
    background-color: var(--surface-up);
}

.api-playground__model-select:focus {
    outline: none;
    border-color: rgba(255, 69, 0, 0.5);
    box-shadow: 0 0 0 3px rgba(255, 69, 0, 0.12);
}

.api-playground__composer-input-wrap {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    align-self: stretch;
    min-height: 0;
}

.api-playground__input-main {
    display: block;
    width: 100%;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--white);
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0.5rem 0.25rem;
    resize: none;
    min-height: 2.75rem;
    max-height: 12rem;
    vertical-align: middle;
    caret-color: var(--accent-bright);
    field-sizing: content;
}

@supports not (field-sizing: content) {
    .api-playground__input-main {
        min-height: 2.75rem;
    }
}

.api-playground__input-main::placeholder {
    color: var(--gray);
    opacity: 0.85;
}

.api-playground__input-main:focus {
    outline: none;
}

.api-playground__send {
    flex-shrink: 0;
    width: 2.5rem;
    height: 2.5rem;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: var(--pg-send-bg);
    color: var(--pg-send-fg);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, transform 0.12s ease, opacity 0.12s ease;
}

.api-playground__send:hover:not(:disabled) {
    background: var(--accent-bright);
    color: #fff;
    transform: scale(1.03);
}

.api-playground__send:focus-visible {
    outline: 2px solid var(--accent-bright);
    outline-offset: 2px;
}

.api-playground__send:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.api-playground__send-spinner {
    display: none;
    animation: api-playground-spin 0.65s linear infinite;
    color: var(--pg-send-fg);
}

.api-playground__send:hover:not(:disabled) .api-playground__send-spinner {
    color: #fff;
}

.api-playground__send.is-loading .api-playground__send-icon {
    display: none;
}

.api-playground__send.is-loading .api-playground__send-spinner {
    display: block;
}

@keyframes api-playground-spin {
    to {
        transform: rotate(360deg);
    }
}

.api-playground__composer-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin: 0.55rem 0 0;
    padding: 0 0.75rem;
    font-size: 0.62rem;
    color: var(--gray-dim);
    letter-spacing: 0.02em;
    max-width: 56rem;
    margin-left: auto;
    margin-right: auto;
}

.api-playground__hint-keys {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.api-playground__hint-label {
    color: var(--gray-dim);
    opacity: 0.9;
}

.api-playground__kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.35em;
    padding: 0.2rem 0.4rem;
    font-size: 0.65rem;
    font-family: inherit;
    line-height: 1.2;
    border: 1px solid rgba(244, 244, 245, 0.12);
    border-radius: 6px;
    background: rgba(244, 244, 245, 0.04);
    color: var(--gray);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
}

.api-playground__panel {
    border-left: 1px solid var(--grid-line);
    background: var(--black-elevated);
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Author `display: flex` wins over the default [hidden] rule; force remove from layout. */
.api-playground__panel[hidden] {
    display: none !important;
    border: none;
}

.api-playground__panel-inner {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 1rem 1rem 1.25rem;
    -webkit-overflow-scrolling: touch;
}

.api-playground__panel-inner > .api-playground__card {
    padding: 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--border-muted);
    background: var(--black-muted);
    box-shadow: inset 0 1px 0 rgba(244, 244, 245, 0.03);
}

.api-playground__card {
    margin-bottom: 0.75rem;
}

.api-playground__card:last-of-type {
    margin-bottom: 0;
}

.api-playground__label {
    display: block;
    font-size: 0.65rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--gray-dim);
    margin-bottom: 0.35rem;
}

.api-playground__select {
    width: 100%;
    box-sizing: border-box;
    font-family: "Space Mono", ui-monospace, monospace;
    font-size: 0.72rem;
    padding: 0.45rem 0.5rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--grid-line);
    background: var(--surface);
    color: var(--white);
    cursor: pointer;
}

.api-playground__model-desc {
    font-size: 0.65rem;
    color: var(--gray);
    line-height: 1.5;
    margin: 0.5rem 0 0;
    min-height: 2.5rem;
}

.api-playground__link-out {
    display: inline-block;
    margin-top: 0.5rem;
    font-size: 0.65rem;
    color: var(--accent-bright);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.api-playground__textarea {
    width: 100%;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 0.8rem;
    line-height: 1.45;
    color: var(--white);
    background: var(--surface);
    border: 1px solid var(--grid-line);
    border-radius: var(--radius);
    padding: 0.5rem 0.65rem;
    resize: vertical;
    min-height: 5rem;
}

.api-playground__textarea:focus {
    outline: none;
    border-color: rgba(255, 69, 0, 0.45);
}

.api-playground__hint-text {
    font-size: 0.72rem;
    color: var(--gray);
    line-height: 1.45;
    margin: 0 0 0.5rem;
}

.api-playground__hint-text a {
    color: var(--accent-bright);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.api-playground__input.api-playground__input {
    font-size: 0.75rem;
}

.api-playground__slider-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.api-playground__slider-head .api-playground__label {
    margin-bottom: 0;
}

.api-playground__slider-val {
    font-size: 0.75rem;
    color: var(--gray);
}

.api-playground__range {
    width: 100%;
    accent-color: var(--accent-bright);
}

.api-playground__footnote {
    font-size: 0.58rem;
    color: var(--gray-dim);
    line-height: 1.5;
    margin: 1rem 0 0;
    opacity: 0.95;
}

.api-playground__footnote a {
    color: var(--accent-bright);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.api-playground__visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 960px) {
    .api-playground {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(0, 1fr) auto;
    }

    .api-playground__panel {
        border-left: none;
        border-top: 1px solid var(--grid-line);
        max-height: 45vh;
    }
}

@media (max-width: 520px) {
    .api-playground__model-select {
        max-width: 7rem;
        font-size: 0.62rem;
        padding-left: 0.55rem;
        padding-right: 1.5rem;
    }

    .api-playground__composer-shell {
        padding-left: 0.35rem;
    }
}

html[data-theme="light"] .api-playground__chat {
    background: var(--black);
}

html[data-theme="light"] .api-playground__toolbar {
    background: var(--black);
}

html[data-theme="light"] .api-playground__msg--user .api-playground__msg-body {
    background: var(--surface);
}

html[data-theme="light"] .api-playground__composer-wrap {
    --pg-shell-bg: var(--black-muted);
    --pg-shell-border: rgba(12, 12, 14, 0.12);
    --pg-chip-bg: var(--surface);
    --pg-chip-border: rgba(12, 12, 14, 0.1);
    --pg-send-fg: #f4f4f6;
    --pg-send-bg: #12121a;
    background: var(--black);
    border-top-color: var(--grid-line);
}

html[data-theme="light"] .api-playground__composer-shell {
    box-shadow:
        0 1px 0 rgba(12, 12, 14, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

html[data-theme="light"] .api-playground__model-select:hover {
    background-color: var(--surface-up);
}

html[data-theme="light"] .api-playground__kbd {
    border-color: rgba(12, 12, 14, 0.12);
    background: rgba(12, 12, 14, 0.04);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
}

html[data-theme="light"] .api-playground__panel-inner > .api-playground__card {
    box-shadow: none;
}

html[data-theme="light"] .api-playground__send:hover:not(:disabled) {
    color: #fff;
}

/* —— Images playground: 3×2 viewport, horizontal scroll for more; composer pinned bottom —— */
body[data-api-page="images"] .api-content--playground {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
}

body[data-api-page="images"] .api-playground {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.api-playground--images {
    align-items: stretch;
}

/* Full-width main column when the right info panel is closed (panel is display:none). */
.api-playground--images.api-playground--panel-hidden {
    grid-template-columns: minmax(0, 1fr);
}

.api-playground--images.api-playground--panel-hidden .api-playground__panel {
    display: none !important;
    border: none;
}

.api-img-play {
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
}

.api-img-play .api-playground__toolbar,
.api-img-play__meta {
    flex-shrink: 0;
}

/* Float over the grid so the strip can use full height; tiles show through / sit behind the pill. */
.api-img-play .api-playground__composer-wrap {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    padding: 0.5rem 1.25rem calc(0.85rem + env(safe-area-inset-bottom, 0px));
    background: transparent;
    border-top: none;
    box-shadow: none;
    pointer-events: none;
}

.api-img-play .api-playground__composer-shell,
.api-img-play .api-playground__composer-hint {
    pointer-events: auto;
}

.api-img-play .api-playground__composer-hint {
    margin-top: 0.35rem;
    opacity: 0.92;
    text-shadow: 0 1px 10px rgba(5, 5, 5, 0.95);
}

html[data-theme="light"] .api-img-play .api-playground__composer-hint {
    text-shadow: 0 1px 8px rgba(255, 255, 255, 0.98);
}

.api-img-play__icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    margin: 0;
    border: 1px solid var(--grid-line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--gray);
    cursor: pointer;
    transition:
        color 0.15s ease,
        border-color 0.15s ease,
        background 0.15s ease;
}

.api-img-play__icon-btn:hover {
    color: var(--white);
    border-color: rgba(244, 244, 245, 0.2);
    background: var(--black-muted);
}

.api-img-play__icon-btn:focus-visible {
    outline: 2px solid var(--accent-bright);
    outline-offset: 2px;
}

.api-playground__panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-shrink: 0;
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid var(--grid-line);
    background: var(--black-elevated);
}

.api-playground__panel-head-title {
    font-size: 0.65rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--gray-dim);
}

.api-img-play__panel-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--gray-dim);
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease;
}

.api-img-play__panel-close:hover {
    color: var(--white);
    background: rgba(244, 244, 245, 0.06);
}

.api-img-play__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    padding: 0.35rem 1rem 0.5rem;
    border-bottom: 1px solid var(--grid-line);
}

.api-img-play__model-line {
    margin: 0;
    font-size: 0.68rem;
    color: var(--gray-dim);
    line-height: 1.4;
    flex: 1;
    min-width: 0;
}

.api-img-play__meta-link {
    font-size: 0.68rem;
    color: var(--accent-bright);
    text-decoration: none;
    flex-shrink: 0;
}

.api-img-play__meta-link:hover {
    text-decoration: underline;
}

/* Container size queries: cell = min(⅓ width, half of height minus composer reserve) so 3×2 fits neatly. */
.api-img-play__grid-wrap {
    --ig-composer-reserve: calc(6.75rem + env(safe-area-inset-bottom, 0px));
    container-type: size;
    container-name: ig-strip;
    flex: 1;
    min-height: 0;
    min-width: 0;
    padding: 0.75rem 1.25rem 0.35rem;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
}

.api-img-play__grid {
    --ig-cell: min(
        calc(100cqi / 3),
        calc(max(0px, 100cqb - var(--ig-composer-reserve)) / 2)
    );
    display: grid;
    grid-template-rows: repeat(2, var(--ig-cell));
    grid-auto-flow: column;
    grid-auto-columns: var(--ig-cell);
    gap: 0;
    box-sizing: border-box;
    flex-shrink: 0;
    /* At least one full viewport of 3×2; grows wider when there are more than 6 tiles (horizontal scroll). */
    width: max-content;
    min-width: 100%;
    height: calc(var(--ig-cell) * 2);
    margin: 0;
    align-content: start;
    align-items: stretch;
}

@supports not (container-type: size) {
    .api-img-play__grid-wrap {
        container-type: inline-size;
    }

    .api-img-play__grid {
        --ig-cell: min(calc(100cqi / 3), 28vmin);
        max-height: none;
    }
}

.api-playground__panel-inner .api-playground__card .api-playground__model-desc:first-of-type {
    margin-top: 0;
}

.api-img-cell {
    position: relative;
    aspect-ratio: 1;
    border-radius: 0;
    border: 1px solid var(--grid-line);
    background: var(--black-muted);
    overflow: hidden;
}

.api-img-cell--empty {
    border-style: dashed;
    opacity: 0.45;
    min-height: 0;
    min-width: 0;
}

.api-img-cell--loading {
    border-color: rgba(255, 69, 0, 0.35);
    background: radial-gradient(ellipse 90% 80% at 50% 50%, #1a1510 0%, #0a0a0c 72%);
    animation: api-img-loading-pulse 2.2s ease-in-out infinite;
}

@keyframes api-img-loading-pulse {
    0%,
    100% {
        filter: brightness(1);
        box-shadow: inset 0 0 0 1px rgba(255, 69, 0, 0.12);
    }
    50% {
        filter: brightness(1.08);
        box-shadow: inset 0 0 32px rgba(255, 69, 0, 0.08);
    }
}

.api-img-cell__loading-inner {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.65rem;
    gap: 0.5rem;
}

.api-img-cell__prompt {
    margin: 0;
    text-align: center;
    font-size: 0.72rem;
    line-height: 1.35;
    color: rgba(244, 244, 245, 0.92);
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    max-width: 100%;
}

.api-img-cell__timer {
    position: absolute;
    left: 0.5rem;
    bottom: 0.45rem;
    font-size: 0.65rem;
    color: var(--gray-dim);
}

.api-img-cell--done .api-img-cell__media {
    position: absolute;
    inset: 0;
}

.api-img-cell__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    cursor: zoom-in;
}

.api-img-cell__hover {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 0.45rem;
    padding: 0.55rem;
    background: linear-gradient(180deg, transparent 25%, rgba(5, 5, 5, 0.88));
    opacity: 0;
    transition: opacity 0.22s ease;
    pointer-events: none;
}

.api-img-cell--done:hover .api-img-cell__hover {
    opacity: 1;
}

.api-img-cell__hover-prompt {
    margin: 0;
    font-size: 0.65rem;
    line-height: 1.35;
    color: rgba(244, 244, 245, 0.95);
    pointer-events: auto;
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.api-img-cell__download {
    position: absolute;
    top: 0.45rem;
    right: 0.45rem;
    z-index: 1;
    pointer-events: auto;
    padding: 0;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(244, 244, 245, 0.22);
    background: rgba(5, 5, 5, 0.62);
    color: var(--white);
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.api-img-cell__download svg {
    flex-shrink: 0;
}

.api-img-cell__download:hover {
    background: rgba(255, 69, 0, 0.28);
    border-color: rgba(255, 69, 0, 0.45);
    color: var(--white);
}

html[data-theme="light"] .api-img-cell__hover {
    background: linear-gradient(180deg, transparent 25%, rgba(12, 12, 14, 0.82));
}

html[data-theme="light"] .api-img-cell__download {
    background: rgba(255, 255, 255, 0.94);
    color: #0c0c0e;
    border-color: rgba(12, 12, 14, 0.16);
}

html[data-theme="light"] .api-img-cell__download:hover {
    background: rgba(255, 69, 0, 0.14);
    border-color: rgba(255, 69, 0, 0.35);
    color: #0c0c0e;
}

/* Lightbox */
body.api-img-lightbox-open {
    overflow: hidden;
}

.api-img-lightbox {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: min(1.25rem, 4vw);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.34s ease, visibility 0.34s;
}

.api-img-lightbox.is-open {
    opacity: 1;
    visibility: visible;
}

.api-img-lightbox__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 5, 5, 0.88);
    backdrop-filter: blur(10px);
}

html[data-theme="light"] .api-img-lightbox__backdrop {
    background: rgba(244, 244, 246, 0.92);
}

.api-img-lightbox__stage {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: min(96vw, 1080px);
    max-height: calc(100vh - 2rem);
    transform: scale(0.94) translateY(14px);
    opacity: 0;
    transition:
        transform 0.42s cubic-bezier(0.22, 1, 0.36, 1),
        opacity 0.35s ease;
}

.api-img-lightbox.is-open .api-img-lightbox__stage {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.api-img-lightbox__close {
    position: absolute;
    top: -0.25rem;
    right: 0;
    z-index: 3;
    width: 2.25rem;
    height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid var(--grid-line);
    background: var(--black-muted);
    color: var(--gray);
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    transition:
        color 0.15s ease,
        border-color 0.15s ease,
        background 0.15s ease;
}

.api-img-lightbox__close:hover {
    color: var(--orange);
    border-color: rgba(255, 69, 0, 0.45);
}

.api-img-lightbox__img-wrap {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--grid-line);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.api-img-lightbox__img {
    display: block;
    max-width: 100%;
    max-height: min(72vh, 820px);
    width: auto;
    height: auto;
    object-fit: contain;
}

.api-img-lightbox__footer {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
    max-width: 42rem;
    margin-top: 1rem;
    padding: 0 0.15rem;
}

.api-img-lightbox__bubble-wrap {
    flex: 1 1 14rem;
    min-width: 0;
}

.api-img-lightbox__bubble {
    margin: 0;
    padding: 0.85rem 1.1rem;
    font-size: 0.8125rem;
    line-height: 1.5;
    color: var(--white);
    border-radius: 1.15rem 1.15rem 1.15rem 0.3rem;
    background: var(--black-elevated);
    border: 1px solid var(--grid-line);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.api-img-lightbox__download {
    flex-shrink: 0;
    font-size: 0.75rem;
    padding: 0.45rem 0.85rem;
}

@media (prefers-reduced-motion: reduce) {
    .api-img-lightbox,
    .api-img-lightbox__stage,
    .api-img-cell__hover {
        transition-duration: 0.01ms !important;
    }
}

.api-img-cell--error {
    padding: 0.65rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    justify-content: center;
}

.api-img-cell__err-title {
    font-size: 0.65rem;
    color: var(--orange);
}

.api-img-cell__err-body {
    margin: 0;
    font-size: 0.62rem;
    color: var(--gray-dim);
    line-height: 1.4;
    word-break: break-word;
}

.api-playground--images .api-playground__composer-shell--images {
    max-width: none;
    width: 100%;
    margin-left: 0;
    margin-right: 0;
    box-sizing: border-box;
    /* Opaque bar removed: only the pill is filled; grid shows through the rest. */
    background: rgba(10, 10, 12, 0.58);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow:
        0 1px 0 rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(244, 244, 245, 0.05),
        0 0 0 1px rgba(244, 244, 245, 0.1);
}

html[data-theme="light"] .api-img-play .api-playground__composer-wrap {
    background: transparent;
    border-top: none;
}

html[data-theme="light"] .api-playground--images .api-playground__composer-shell--images {
    background: rgba(244, 244, 245, 0.78);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow:
        0 1px 0 rgba(12, 12, 14, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.55),
        0 0 0 1px rgba(12, 12, 14, 0.1);
}
