:root {
    --primary: #000000;
    --accent: #2b6cb0;
    --bg: #F5F6FA;
    --card-bg: #ffffff;
    --text: #000000;
    --muted: #4a5a6a;
    --border: 1px solid #e6edf4;
    --radius: 16px;
    --shadow: 0 0 0 1px rgba(11, 31, 58, 0.06), 0 1px 2px rgba(11, 31, 58, 0.04), 0 8px 24px rgba(11, 31, 58, 0.05);
}

/* Keep scrolling available while reducing visual noise until the control is used. */
:where(.code-block pre, .prompt-modal, .prompt-table-list-wrap) {
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
}

:where(.code-block pre, .prompt-modal, .prompt-table-list-wrap):hover,
:where(.code-block pre, .prompt-modal, .prompt-table-list-wrap):focus-within,
:where(.code-block pre, .prompt-modal, .prompt-table-list-wrap):active {
    scrollbar-color: var(--scrollbar-thumb, #4a5568) transparent;
}

:where(.code-block pre, .prompt-modal, .prompt-table-list-wrap)::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

:where(.code-block pre, .prompt-modal, .prompt-table-list-wrap)::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 4px;
}

:where(.code-block pre, .prompt-modal, .prompt-table-list-wrap):hover::-webkit-scrollbar-thumb,
:where(.code-block pre, .prompt-modal, .prompt-table-list-wrap):focus-within::-webkit-scrollbar-thumb,
:where(.code-block pre, .prompt-modal, .prompt-table-list-wrap):active::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb, #4a5568);
}

.api-container {
    max-width: 1255px;
    margin: 0 auto;
    padding: 20px;
}

.api-page-header {
    position: static;
    top: auto;
    z-index: auto;
}

/* Category cards */
.category-grid {
    display: block;
    /* margin-bottom: 28px; */
    position: static;
    top: auto;
    z-index: 20;
    padding: 12px 0 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: #F5F6FA;
    /* background: #ffffff; */
}

.category-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.category-cards .category-card {
    flex: 1 1 calc((100% - 20px) / 2);
}

.category-grid.is-collapsed .category-cards {
    gap: 0;
}

.category-grid.is-collapsed .category-cards .category-card {
    flex: 1 1 200px;
    height: 53px;
    min-height: 53px;
    margin: 0;
    padding: 14px 12px;
}

.category-grid.is-collapsed .category-card .icon,
.category-grid.is-collapsed .category-card p {
    display: none;
}

.category-grid.is-collapsed .category-card h3 {
    margin: 0;
    font-size: 1rem;
    margin-bottom: 0 !important;
}

.category-grid.selected-state,
.category-grid.is-collapsed {
    position: sticky;
    top: 0;
    z-index: 30;
    padding-top: 10px;
}

/* 4 cards x ~220px plus gaps and page padding. Below this, one row no longer fits. */
@media (max-width: 1100px) {
    .category-grid.is-collapsed .category-cards {
        display: flex;
        flex-direction: column;
        gap: 0;
        overflow: hidden;
        border: 1px solid #d7e3f0;
        border-radius: 10px;
        background: #fff;
    }

    .category-grid.is-collapsed .category-cards .category-card {
        flex: 0 0 auto;
        width: 100%;
        height: auto;
        min-height: 44px;
        margin: 0;
        padding: 12px 14px;
        border: 0;
        border-radius: 0;
        border-bottom: 1px solid #e6edf4;
        box-shadow: none;
        background: #fff;
        background-clip: padding-box;
        transform: none;
        justify-content: center;
    }

    .category-grid.is-collapsed .category-cards .category-card:nth-child(even) {
        background: #f4f8fc;
    }

    .category-grid.is-collapsed .category-cards .category-card:last-child {
        border-bottom: 0;
    }

    .category-grid.is-collapsed .category-card.report-card:hover {
        box-shadow: none;
        transform: none;
        background: #eaf2fb;
    }

    .category-grid.is-collapsed .category-card.active {
        background: #e7f1fb;
        border: 0;
        border-bottom: 1px solid #e6edf4;
        box-shadow: inset 3px 0 0 #1d5e9e;
    }

    .category-grid.is-collapsed .category-cards .category-card:last-child.active {
        border-bottom: 0;
    }

    .category-grid.is-collapsed .category-card h3 {
        font-size: 0.95rem;
        font-weight: 600;
        line-height: 1.3;
    }

    .category-grid.is-collapsed,
    .category-grid.is-collapsed .arrow-container {
        position: static;
        top: auto;
    }

    .category-grid.selected-state:not(.is-collapsed),
    .category-grid.selected-state:not(.is-collapsed)+.arrow-container {
        position: static;
        top: auto;
    }

    .category-grid.selected-state:not(.is-collapsed) .category-cards {
        row-gap: 20px;
        column-gap: 20px;
    }

    .category-grid.selected-state:not(.is-collapsed) .category-card {
        flex: 1 1 calc((100% - 20px) / 2);
        width: auto;
        height: auto;
    }
}

@media (max-width: 640px) {
    .category-grid.selected-state:not(.is-collapsed) .category-cards {
        flex-direction: column;
        gap: 0;
        row-gap: 0;
        column-gap: 0;
    }

    .category-grid.selected-state:not(.is-collapsed) .category-card {
        flex-basis: auto;
        width: 100%;
    }

    .category-grid.is-collapsed .category-cards {
        gap: 0;
        row-gap: 0;
        column-gap: 0;
    }
}

.api-container {
    --guide-sticky-offset: 0px;
}

.category-grid.is-collapsed .category-toggle {
    margin-top: 5px;
}

.category-grid.initial-state .category-toggle {
    display: none;
}

.category-toggle {
    position: relative;
    z-index: 31;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 30px;
    padding: 0;
    color: var(--text);
    /* background: var(--card-bg); */
    background: #F5F6FA;
    border: none;
    border-radius: 8px;
    /* box-shadow: 0 1px 4px rgba(45, 55, 72, 0.08); */
    cursor: pointer;
    margin: 5px auto 10px;
}

.category-toggle:hover,
.category-toggle:focus-visible {
    /* color: var(--accent); */
    border: 1px solid black;
    box-shadow: 0 2px 6px rgba(45, 55, 72, 0.12);
}


.category-arrow {
    width: 10px;
    height: 10px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: translateY(2px) rotate(225deg);
    transition: transform 0.2s ease;
}

.arrow-container {
    position: sticky;
    top: 200px;
    z-index: 32;
    height: 32px;
}

.category-grid.is-collapsed+.arrow-container {
    top: 76px;
}

.category-toggle[aria-expanded="false"] .category-arrow {
    transform: translateY(-2px) rotate(45deg);
}

.api-container.category-collapsed {
    padding-top: 0;
}

.category-grid.initial-state .category-card {
    min-height: 300px;
    padding: 20px;
}

@media (min-width: 1101px) {
    .category-grid.selected-state:not(.is-collapsed) .category-cards {
        gap: 12px;
    }
}

.category-grid.is-collapsed .category-cards,
.category-grid.is-collapsed.selected-state .category-cards {
    gap: 0;
    row-gap: 0;
    column-gap: 0;
}

@media (min-width: 1101px) {

    .category-grid.is-collapsed .category-cards,
    .category-grid.is-collapsed.selected-state .category-cards {
        gap: 12px;
    }
}

.category-grid.selected-state .category-card {
    flex-basis: calc((100% - 36px) / 4);
    height: 193px;
    min-height: 193px;
    padding: 16px 12px;
}

.category-grid.selected-state .category-card .icon {
    width: 72px;
    height: 72px;
    margin-bottom: 6px;
}

.category-grid.selected-state .category-card h3 {
    font-size: 1.1rem;
    margin-bottom: 5px;
}

.category-grid.selected-state .category-card p {
    font-size: 0.85rem;
}

.category-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    min-height: 260px;
    padding: 22px 24px;
    cursor: pointer;
    border: none;
    color: var(--text);
    font: inherit;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.guide-section .report-card:hover {
    box-shadow: none;
    transition: none;
}


/* Border, lift, and shadow come from FA.css .report-card. */
/* .category-card.report-card {
    margin-bottom: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.category-card.report-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
} */

/* .category-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
} */

.category-card:focus {
    outline: none;
}

.category-card:focus-visible {
    outline: 3px solid #1d3557;
    outline-offset: 3px;
    z-index: 1;
}

.category-card.active {
    border: 2px solid #1d5e9e;
    box-shadow: 0 0 0 2px rgba(29, 94, 158, 0.18);
}

.category-card .icon {
    width: 160px;
    height: 160px;
    max-height: 160px;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.65rem;
    margin-bottom: 12px;
    background: transparent;
}

.category-card .icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.category-card .icon,
.category-card h3,
.category-card p {
    opacity: 1;
}

.category-card h3 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 8px;
    /* color: var(--primary); */
    color: #0066cc;
}

.category-card p {
    max-height: 200px;
    font-size: 1rem;
    color: var(--muted);
    line-height: 1.3;
}

.category-card .badge {
    position: absolute;
    top: 12px;
    right: 12px;
    font-size: 0.68rem;
    background: #edf2f7;
    color: var(--muted);
    padding: 2px 7px;
    border-radius: 20px;
    font-weight: 500;
}

/* Content panels */
.content-panel {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    /* border: 1px solid var(--border); */
    padding: 30px 26px;
    display: none;
    margin: 0 4px;
}

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

.content-panel#basics,
.content-panel#python,
.content-panel#ai,
.content-panel#notices {
    background: transparent;
    box-shadow: none;
    padding: 0;
    margin: 0 2px;
}

.guide-subsection {
    scroll-margin-top: 24px;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 26px;
}

.guide-subsection+.guide-subsection {
    margin-top: 28px;
}

.guide-subsection h2 {
    margin-top: 0;
}

.content-panel h2 {
    font-size: 1.2rem;
    color: var(--primary);
    margin-bottom: 6px;
    padding-bottom: 10px;
    border-bottom: 2px solid #edf2f7;
}

.content-panel .subtitle {
    color: var(--muted);
    margin-bottom: 22px;
    font-size: 0.95rem;
}

.guide-page-layout {
    padding-bottom: 80px;
}

.guide-content {
    min-width: 0;
}

.guide-section {
    min-width: 0;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px 24px 20px;
    margin-bottom: 20px;
    scroll-margin-top: 24px;
    overflow: clip;
}

.guide-section>h2,
.guide-section .prompts-header-row {
    position: sticky;
    top: var(--guide-sticky-offset, 0px);
    z-index: 12;
    background: var(--card-bg);
    border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0;
}

.guide-section>h2 {
    margin: -22px -24px 14px;
    display: flex;
    align-items: flex-end;
    height: 60px;
    min-height: 60px;
    box-sizing: border-box;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text);
    /* border-bottom: 2px solid var(--border); */
    padding: 10px 24px;
}

.guide-section h3 {
    margin: 18px 0 8px;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text);
}

.guide-section p,
.guide-section li {
    color: var(--text);
    font-size: 1rem;
    line-height: 1.6;
}

.guide-section ul {
    padding-left: 1.25rem;
    margin: 0.5rem 0 0;
}

.guide-section code {
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 1em;
    border-radius: 4px;
}

.guide-section .code-block,
.guide-section .code-display-container {
    min-width: 0;
    max-width: 100%;
}

.guide-section pre {
    max-width: 100%;
    overflow-wrap: anywhere;
}

.spec-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 1rem;
    border: var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: #fff;
}

.spec-table th,
.spec-table td {
    /* border-right: var(--border); */
    border-bottom: var(--border);
}

.spec-table th:last-child,
.spec-table td:last-child {
    border-right: none;
}

.spec-table th {
    text-align: left;
    background: var(--accent-ink);
    color: white;
    font-weight: 500;
    padding: 10px 12px;
}

.spec-table th:first-child {
    border-top-left-radius: var(--radius);
}

.spec-table th:last-child {
    border-top-right-radius: var(--radius);
}

.spec-table td {
    padding: 10px 12px;
    vertical-align: top;
}

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

.spec-table tr:last-child td:first-child {
    border-bottom-left-radius: var(--radius);
}

.spec-table tr:last-child td:last-child {
    border-bottom-right-radius: var(--radius);
}

.code-block {
    position: relative;
    background: #f6f8fb;
    color: black;
    border-radius: 10px;
    padding: 0 0 0 16px;
    overflow-x: auto;
    font-size: 1rem;
    line-height: 1.5;
    margin: 10px 0 6px;
}

.code-block-prompt {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    background: #fff;
    border-radius: 8px;
    padding: 6px 6px 6px 10px;
    border: 1px solid #e6edf4;
    min-width: 0;
}

.code-block-prompt pre {
    margin: 0;
    white-space: break-spaces;
    font-family: var(--mono) !important;
}

.code-block pre {
    margin: 0;
    white-space: break-spaces;
    font-family: var(--mono) !important;
    --scrollbar-thumb: #cbd5e0;
    padding-block: 14px;
    max-height: 500px;
}

.copy-btn {
    min-width: 24px;
    height: 36px;
    padding: 5px;
    border: 1px solid var(--line-strong);
    background: #fff;
    color: var(--navy);
    font: inherit;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    position: absolute;
    right: 15px;
    top: 10px;
    z-index: 2;
}

.copy-btn:hover {
    background: var(--accent-soft);
    border-color: #b9cce0;
}

.copy-btn.is-copied {
    background: #e5f6ee;
    border-color: #9ad4b8;
    color: var(--ok);
    z-index: 2;
}

.copy-status {
    position: fixed;
    right: 16px;
    top: 16px;
    z-index: 50;
    max-width: min(360px, calc(100vw - 32px));
    margin: 0;
    padding: 12px 16px;
    border: 1px solid #9ad4b8;
    border-radius: 8px;
    background: #e5f6ee;
    color: var(--ok);
    box-shadow: var(--shadow);
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 150ms ease, transform 150ms ease;
}

.copy-status.is-visible {
    opacity: 1;
    transform: none;
}

.copy-status[hidden] {
    display: none;
}

.copy-status-message {
    flex: 1;
}

.copy-status-close {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid currentColor;
    border-radius: 4px;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font-size: 1.4rem;
    line-height: 1;
}

.copy-status-close:focus-visible {
    outline: 3px solid #005fcc;
    outline-offset: 2px;
}

.endpoint-pill {
    display: block;
    background: #f6f8fb;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px 12px;
    font-family: var(--mono);
    font-size: 0.8rem;
    margin: 4px 0;
    word-break: break-all;
}

.method-badge {
    font-weight: 800;
    font-size: 0.7rem;
    letter-spacing: 0.04em;
    background: var(--accent);
    color: #fff;
    padding: 3px 8px;
    border-radius: 4px;
    flex: 0 0 auto;
}

.prompt-card {
    background: #f6f8fb;
    border-radius: 10px;
    padding: 14px 16px;
    margin: 12px 0;
}

.prompt-card h3 {
    margin: 0 0 8px;
    font-size: 1.1rem;
}

.toc-guide a {
    padding-left: 10px;
}

@media (max-width: 640px) {
    .api-container {
        padding: 16px 14px;
    }

    .api-page-header {
        padding-right: 14px;
        padding-left: 14px;
    }

    .category-grid:not(.is-collapsed):not(.selected-state) .category-cards {
        gap: 12px;
    }

    .category-grid.is-collapsed .category-cards {
        gap: 0;
        row-gap: 0;
        column-gap: 0;
    }

    .category-grid.selected-state:not(.is-collapsed) .category-cards {
        gap: 0;
        row-gap: 0;
        column-gap: 0;
    }

    .category-grid:not(.is-collapsed) .category-cards .category-card {
        flex-basis: calc((100% - 12px) / 2);
    }

    .category-toggle {
        margin-top: -12px;
    }

    .category-grid.initial-state .category-card {
        min-height: 220px;
        padding: 16px 12px;
    }

    .category-grid.initial-state .category-card .icon {
        width: 96px;
        height: 96px;
    }

    .content-panel {
        padding: 18px 14px;
        margin: 0;
    }

    .guide-subsection {
        padding: 18px 14px;
    }

    .guide-section {
        padding: 16px 14px;
    }

    .guide-section .prompts-header-row {
        align-items: flex-start;
        gap: 10px;
    }

    .guide-section .code-block {
        padding-left: 10px;
    }

    .skill-header {
        align-items: flex-start;
        flex-wrap: wrap;
        gap: 8px;
    }

    .spec-table {
        font-size: 1rem;
    }

    .spec-table th,
    .spec-table td {
        padding: 8px;
    }
}

.toc-guide>li {
    list-style-type: none
}

.toc-section a {
    padding-left: 10px;
}

.prompts-header-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    height: 60px;
    min-height: 60px;
    margin: -22px -24px 8px;
    flex-wrap: nowrap;
    box-sizing: border-box;
    box-shadow: inset 0 -2px 0 var(--line);
    padding: 10px 24px;
}

.prompts-header-row h2 {
    display: flex;
    align-items: flex-end;
    height: 42px;
    min-height: 42px;
    margin: 0;
    padding-bottom: 0;
    box-sizing: border-box;
    border-bottom: none;
    font-weight: 600;
}

/* ========== Prompt modal (two-step wizard matching design screenshots) ========== */
.prompt-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 17, 23, 0.45);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.prompt-overlay.active {
    display: flex;
    opacity: 1;
}

.prompt-modal {
    background: #ffffff;
    border: 1px solid #e2e5eb;
    border-radius: 14px;
    width: 100%;
    max-width: 1200px;
    max-height: 90%;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.14);
    overflow: hidden;
    transform: scale(0.97);
    transition: transform 0.25s ease;
}

.prompt-overlay.active .prompt-modal {
    transform: scale(1);
}

.prompt-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 18px 22px 10px;
    background: #fff;
}

.prompt-modal-header-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.prompt-step-label {
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: #6b7280;
    text-transform: uppercase;
}

.prompt-modal-header h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 500;
    color: #1a1d27;
    line-height: 1.3;
}

.prompt-close-btn {
    background: transparent;
    border: none;
    color: #6b7280;
    font-size: 22px;
    cursor: pointer;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.prompt-close-btn:hover {
    background: rgba(0, 0, 0, 0.06);
    color: #1a1d27;
}

.prompt-progress {
    display: flex;
    align-items: center;
    padding: 0 22px 14px;
    border-bottom: 1px solid #eef0f4;
}

.prompt-progress-step {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #9ca3af;
    font-size: 1.2rem;
    font-weight: 500;
}

.prompt-progress-step.active {
    color: #1a1d27;
}

.prompt-progress-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid #d1d5db;
    font-size: 1.3rem;
    font-weight: 700;
    background: #fff;
    color: #9ca3af;
}

.prompt-progress-step.active .prompt-progress-num {
    background: #1a1d27;
    border-color: #1a1d27;
    color: #fff;
}

.prompt-progress-step.done .prompt-progress-num {
    background: #12b76a;
    border-color: #12b76a;
    color: #fff;
}

.prompt-progress-line {
    flex: 1;
    height: 2px;
    background: #e5e7eb;
    margin: 0 12px;
}

.prompt-progress-line.filled {
    background: #12b76a;
}

.prompt-step-panel {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    /* overflow: hidden; */
}

.prompt-step1-body,
.prompt-step2-body {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 16px 22px 8px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    width: 100%;
    box-sizing: border-box;
}

.prompt-hint {
    margin: 0 0 10px;
    font-size: 1.1rem !important;
    color: #4b5563;
    line-height: 1.5;
    flex-shrink: 0;
}

.prompt-section-label {
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    color: #6b7280;
    /* text-transform: uppercase; */
    margin: 0px 0 10px;
}

#webTableSectionLabel {
    margin-top: 0;
    margin-bottom: 0px;
    flex-shrink: 0;
}

#promptTableCount,
#promptTableACount,
#promptTableBCount {
    flex-shrink: 0;
}

.prompt-example-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 14px;
}

.prompt-example-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    transition: border-color .15s, background .15s, box-shadow .15s;
    position: relative;
}

.prompt-example-card:hover {
    border-color: #c7d2fe;
    background: #fafafe;
}

.prompt-example-card.selected {
    border-color: #4f6ef7;
    background: rgba(79, 110, 247, 0.04);
    box-shadow: 0 0 0 1px #4f6ef7;
}

.prompt-example-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.prompt-example-icon {
    flex-shrink: 0;
    color: #6b7280;
    margin-top: 0;
}

.prompt-example-card.selected .prompt-example-icon {
    color: #4f6ef7;
}

.prompt-example-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.prompt-example-title {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: #4E69DF;
}

.prompt-example-name {
    font-size: 1.1rem;
    font-weight: 500;
    color: #1a1d27;
    line-height: 1.3;
}

.prompt-example-desc {
    font-size: 1rem;
    color: #6b7280;
    line-height: 1.4;
}

.prompt-example-radio {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid #d1d5db;
    margin-top: 2px;
    position: relative;
}

.prompt-example-card.selected .prompt-example-radio {
    border-color: #4f6ef7;
}

.prompt-example-card.selected .prompt-example-radio::after {
    content: '';
    position: absolute;
    inset: 3px;
    border-radius: 50%;
    background: #4f6ef7;
}

.prompt-table-search-wrap {
    position: relative;
    margin-bottom: 6px;
    width: 100%;
    box-sizing: border-box;
}

.prompt-search-icon,
.search-table-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    pointer-events: none;
    display: block;
}

.prompt-table-search-input {
    width: 100%;
    padding: 10px 12px 10px 36px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    color: #1a1d27;
    background: #f7f8fa;
    outline: none;
    box-sizing: border-box;
}

.prompt-table-search-input:focus {
    border-color: #4f6ef7;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(79, 110, 247, 0.12);
}

.prompt-table-hint {
    margin: 0 0 8px;
    font-size: 12px;
    color: #9ca3af;
}

.prompt-table-list-wrap {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
    width: 100%;
    flex: 1 1 auto;
    min-height: 180px;
    max-height: min(52vh, 440px);
    display: flex;
    flex-direction: column;
    padding-top: 0;
}

.prompt-table-list {
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1 1 auto;
    margin-top: 0;
    max-height: min(52vh, 440px);
    height: auto;
    background: #fff;
    width: 100%;
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: #9ca3af transparent;
    -webkit-overflow-scrolling: touch;
}

.prompt-table-list::-webkit-scrollbar {
    width: 8px;
}

.prompt-table-list::-webkit-scrollbar-thumb {
    background: #9ca3af;
    border-radius: 4px;
}

.prompt-table-list::-webkit-scrollbar-track {
    background: transparent;
}

.prompt-table-list.dual {
    min-height: 200px;
    max-height: min(42vh, 360px);
    height: min(42vh, 360px);
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    width: 100%;
    box-sizing: border-box;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.prompt-table-group-header {
    padding: 8px 14px 4px;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    /* text-transform: uppercase; */
    color: #6b7280;
    background: #f9fafb;
    position: sticky;
    top: 0;
    z-index: 2;
}

.prompt-table-group-header-url {
    color: inherit;
    text-decoration: none;
}

.prompt-table-group-header-url:hover {
    text-decoration: underline !important;
    color: inherit !important;
}

/* Theme sticks at the top of the scrollable list */
.prompt-table-group-header.theme {
    font-size: 1.15rem;
    font-weight: 600;
    z-index: 3;
    background: #f9fafb;
    top: 0;
}

/* Subject sticks directly below the theme header (~ theme padding + line-height) */
.prompt-table-group-header.subject {
    color: #4f6ef7;
    text-transform: none;
    letter-spacing: 0;
    font-size: 1.1rem;
    padding-top: 6px;
    background: #fff;
    z-index: 2;
    top: calc(1.15rem * 1.5 + 12px);
}

.prompt-table-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    border: 0;
    border-bottom: 1px solid #f3f4f6;
    background: transparent;
    text-align: left;
    cursor: pointer;
    transition: background .12s;
    font-family: inherit;
}

.prompt-table-row:hover:not(.disabled) {
    background: rgba(79, 110, 247, 0.06);
}

.prompt-table-row.selected {
    background: rgba(79, 110, 247, 0.1);
}

.prompt-table-row.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.prompt-table-row-radio {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid #d1d5db;
    margin-top: 2px;
    position: relative;
}

.prompt-table-row.selected .prompt-table-row-radio {
    border-color: #4f6ef7;
}

.prompt-table-row.selected .prompt-table-row-radio::after {
    content: '';
    position: absolute;
    inset: 2.5px;
    border-radius: 50%;
    background: #4f6ef7;
}

.prompt-table-row-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.prompt-table-row-code {
    font-size: 1rem;
    font-weight: 500;
    color: #1a1d27;
    font-family: "SF Mono", "Fira Code", Consolas, Monaco, monospace;
}

.prompt-table-row-code a {
    color: #4f6ef7;
    text-decoration: none;
}

.prompt-table-row-code a:hover {
    text-decoration: underline;
}

.prompt-table-row-title {
    font-size: 1rem;
    color: #6b7280;
    line-height: 1.35;
}

.prompt-table-empty {
    padding: 20px 14px;
    text-align: center;
    color: #9ca3af;
    font-size: 13px;
}

.prompt-table-count {
    margin-bottom: 8px;
    font-size: 1rem;
    color: #9ca3af;
    margin-top: 2px;
}

#promptTableACount {
    margin: 0;
}

#promptTableBCount {
    margin: 0;
}


.prompt-dual-tables {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    box-sizing: border-box;
}

.prompt-dual-col {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    min-width: 0;
    min-height: 0;
    box-sizing: border-box;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 12px;
    background: #fafbfc;
    flex: 0 0 auto;
}

/* Active dual column (picker open): taller scrollable list */
.prompt-dual-col.is-active-picker {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.prompt-dual-col.is-active-picker #promptPickerA,
.prompt-dual-col.is-active-picker #promptPickerB {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.prompt-dual-col.is-active-picker .prompt-table-list.dual {
    flex: 1 1 auto;
    min-height: 240px;
    height: min(48vh, 400px);
    max-height: min(48vh, 400px);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.prompt-dual-label {
    letter-spacing: 0.02em;
    font-size: 1rem;
    color: #9ca3af;
    display: inline-flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.prompt-dual-col .prompt-table-list.dual {
    width: 100%;
    min-height: 200px;
    height: min(42vh, 360px);
    max-height: min(42vh, 360px);
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    box-sizing: border-box;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.prompt-dual-col .prompt-table-search-wrap,
.prompt-dual-col .prompt-table-search-input {
    width: 100%;
    box-sizing: border-box;
    flex-shrink: 0;
}

.prompt-dual-col[hidden] {
    display: none !important;
}

.prompt-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 22px;
    border-top: 1px solid #eef0f4;
    background: #fafbfc;
    flex-shrink: 0;
}

.prompt-modal-footer.step2 {
    justify-content: space-between;
}

.prompt-footer-hint {
    font-size: 1rem;
    color: #696969;
}

.prompt-footer-actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.prompt-btn {
    font: inherit;
    font-size: 1.2rem;
    font-weight: 600;
    padding: 9px 18px;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background .15s, border-color .15s, opacity .15s;
}

.prompt-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.prompt-btn-secondary {
    background: #fff;
    border-color: #e5e7eb;
    color: #374151;
}

.prompt-btn-secondary:hover:not(:disabled) {
    background: #f3f4f6;
}

.prompt-btn-primary {
    background: #1a1d27;
    color: #fff;
    border-color: #1a1d27;
}

.prompt-btn-primary:hover:not(:disabled) {
    background: #111827;
}

.prompt-ready-hint {
    margin: 0 0 6px;
    font-size: 13.5px;
    color: #4b5563;
    line-height: 1.5;
}

.prompt-ready-hint.secondary {
    margin-bottom: 16px;
    color: #6b7280;
}

.prompt-ready-card {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #f6f8fb;
    overflow: hidden;
}

.prompt-ready-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    font-size: 1.1rem;
    font-weight: 500;
    color: #1a1d27;
}

.prompt-ready-code-block {
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.prompt-ready-code {
    margin: 0;
    padding: 16px 18px;
    line-height: 1.6;
    color: #1a1d27;
    white-space: pre-wrap;
    word-break: break-word;
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    background: #f6f8fb;
    font-family: var(--mono) !important;
}

.prompt-ready-code a {
    color: #4f6ef7;
    text-decoration: none;
}

.prompt-ready-code a:hover {
    text-decoration: underline;
}

.sample-prompts-icon {
    width: 40px;
    height: 40px;
    display: block;
}

@media (max-width: 640px) {
    .prompt-modal {
        max-width: 100%;
        max-height: 96vh;
        border-radius: var(--radius);
    }

    .prompt-dual-tables {
        display: flex;
        flex-direction: column;
    }

    .prompt-modal-footer {
        flex-wrap: wrap;
    }

    .prompt-footer-hint {
        width: 100%;
    }
}

#semenuToggle {
    transition: transform 0.25s ease;
}

#promptTableSection {
    display: flex;
    flex-direction: column;
    /* Do NOT flex-grow to fill the body — that would remove overflow and block scrolling the prompt up */
    flex: 0 0 auto;
    width: 100%;
    box-sizing: border-box;
    /* After prompt selection: scroll body so this block reaches the top and stays sticky */
    position: sticky;
    top: 0;
    z-index: 5;
    background: #fff;
    align-self: stretch;
    /* When stuck, stay within the step body; table list scrolls inside */
    max-height: 100%;
    overflow: hidden;
    padding-top: 0;
    padding-bottom: 4px;
}

#promptStep1Panel .prompt-step1-body {
    padding-bottom: 40px;
}

#promptTableSection[hidden] {
    display: none !important;
}

#promptSingleSearchWrap {
    flex-shrink: 0;
}

#promptDualTables[hidden],
#promptTableListWrap[hidden],
#promptSingleSearchWrap[hidden] {
    display: none !important;
}

#promptStep1Panel[hidden] {
    display: none !important;
}

#promptStep2Panel[hidden] {
    display: none !important;
}

.prompt-step-panel[hidden] {
    display: none !important;
}

.prompt-example-list {
    width: 100%;
    box-sizing: border-box;
}

.prompt-step1-body>.prompt-hint,
.prompt-step1-body>.prompt-section-label {
    flex: 0 0 auto;
}

/* Selected prompt stays above Web Tables in document flow so it can scroll up out of view
   (and scroll back down into view to change the prompt). */
.prompt-step1-body>#promptSelectedPrompt,
.prompt-step1-body>#promptExamplePicker {
    flex: 0 0 auto;
}

/* Selected table summary (collapsed picker) */
.prompt-selected-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    box-sizing: border-box;
    padding: 12px 14px;
    border: 1.5px solid #9ad4b8;
    border-radius: 10px;
    background: #e5f6ee;
    flex-shrink: 0;
}

/* Prompt 3: Table 2 collapsed before Table 1 is chosen */
.prompt-pending-summary {
    border-color: #e5e7eb;
    background: #f3f4f6;
    cursor: default;
}

.prompt-pending-label {
    font-size: 1.05rem;
    font-weight: 500;
    color: #9ca3af;
    font-style: italic;
}

#promptPendingB[hidden] {
    display: none !important;
}

.prompt-selected-summary[hidden] {
    display: none !important;
}

.prompt-selected-summary-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.prompt-selected-code {
    font-size: 1rem;
    font-weight: 500;
    color: #0f7a4a;
    font-family: "SF Mono", "Fira Code", Consolas, Monaco, monospace;
}

.prompt-selected-code a {
    color: #0f7a4a;
    text-decoration: none;
}

.prompt-selected-code a:hover {
    text-decoration: underline;
}

.prompt-selected-title {
    font-size: 1.2rem;
    color: #3d6b55;
    line-height: 1.35;
}

.prompt-change-table-btn {
    flex-shrink: 0;
    border: 1px solid #9ad4b8;
    background: #fff;
    color: #0f7a4a;
    font: inherit;
    font-size: 1rem;
    font-weight: 600;
    padding: 7px 12px;
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
}

.prompt-change-table-btn:hover {
    background: #d1fae5;
    border-color: #6bc49a;
}

#promptSinglePicker,
#promptPickerA,
#promptPickerB {
    width: 100%;
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
}

#promptSinglePicker[hidden],
#promptPickerA[hidden],
#promptPickerB[hidden] {
    display: none !important;
}

/* Selected prompt summary (collapsed example list) — scrolls with body, not sticky */
.prompt-selected-prompt {
    margin-bottom: 14px;
    flex: 0 0 auto;
    position: relative;
    z-index: 1;
}

.prompt-selected-prompt-kicker {
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    color: #0f7a4a;
    text-transform: uppercase;
}

.prompt-selected-prompt-name {
    font-size: 1.1rem;
    font-weight: 500;
    color: #0f3d2a;
    line-height: 1.3;
}

.prompt-selected-prompt-desc {
    font-size: 1rem;
    color: #3d6b55;
    line-height: 1.4;
}

#promptExamplePicker[hidden] {
    display: none !important;
}

.prompt-btn-reset {
    background: #fff;
    border-color: #f0c4c4;
    color: #b42318;
}

.prompt-btn-reset:hover:not(:disabled) {
    background: #fef3f2;
    border-color: #f97066;
    color: #912018;
}

.code-display-container {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
}

.skill-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 5px 10px 5px 0px;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
}

.skill-header .guidelines-btn {
    gap: 6px;
    white-space: nowrap;
}

.skill-header .guidelines-btn svg {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    fill: currentColor;
    transform: translateY(1px);
}

.code-display-header {
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    padding: 14px 16px;
}

.modal-link {
    color: #2C7177;
    cursor: pointer;
}

.modal-link:hover {
    text-decoration: underline;
}