.jspcv-grammar-ghost {
    position: fixed;
    z-index: 2147483000;
    box-sizing: border-box;
    overflow: hidden;
    pointer-events: none;
    contain: strict;
}

.jspcv-grammar-ghost[hidden] {
    display: none;
}

.jspcv-grammar-ghost-content {
    position: absolute;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    color: var(--theme-text-muted);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.jspcv-grammar-ghost-content,
.jspcv-grammar-ghost-prefix {
    font-family: inherit !important;
}

.jspcv-grammar-ghost-arrow,
.jspcv-grammar-ghost-suggestion {
    font-family: inherit !important;
}

.jspcv-grammar-ghost-arrow {
    display: inline;
}

.jspcv-grammar-ghost-prefix {
    display: none;
    color: transparent;
    -webkit-text-fill-color: transparent;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.jspcv-grammar-caret-mirror {
    position: fixed;
    top: 0;
    left: -100000px;
    z-index: -1;
    min-height: 0;
    margin: 0;
    border: 0;
    visibility: hidden;
    pointer-events: none;
}

.jspcv-grammar-caret-marker {
    display: inline;
    margin: 0;
    padding: 0;
    border: 0;
}

.jspcv-grammar-ghost-arrow,
.jspcv-grammar-ghost-suggestion {
    color: var(--theme-assist-ghost-text);
    -webkit-text-fill-color: var(--theme-assist-ghost-text);
}

.jspcv-grammar-ghost-suggestion {
    font-style: italic;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.jspcv-grammar-ghost-key {
    display: inline-block;
    break-inside: avoid;
    width: fit-content;
    min-width: 0;
    margin-left: var(--type-key-hint-gap, 4px);
    padding-block: var(--type-key-hint-padding-block, 1px);
    padding-inline: var(--type-key-hint-padding-inline, 2px);
    border: 1px solid var(--theme-assist-key-border);
    border-radius: 4px;
    background: var(--theme-assist-key-bg);
    color: var(--theme-assist-key-text);
    -webkit-text-fill-color: var(--theme-assist-key-text);
    font-family: var(--body-font, Arial, sans-serif) !important;
    font-size: 0.82em;
    font-style: normal;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0;
    text-indent: 0;
    white-space: nowrap;
}

.jspcv-grammar-ghost-key[hidden] {
    display: none;
}

.jspcv-grammar-ghost[data-grammar-status="checking"] .jspcv-grammar-ghost-suggestion,
.jspcv-grammar-ghost[data-grammar-status="guidance"] .jspcv-grammar-ghost-suggestion,
.jspcv-grammar-ghost[data-grammar-status="unchanged"] .jspcv-grammar-ghost-suggestion {
    font-style: normal;
}

.jspcv-grammar-ghost[data-grammar-status="checking"] .jspcv-grammar-ghost-content {
    width: 18px !important;
    min-width: 18px;
    height: 18px;
    padding: 0;
}

.jspcv-grammar-ghost[data-grammar-status="checking"] .jspcv-grammar-ghost-content::after {
    position: absolute;
    inset: 2px;
    border: 2px solid var(--theme-text-subtle);
    border-right-color: transparent;
    border-radius: 50%;
    content: "";
    animation: jspcv-assist-clock 0.75s linear infinite;
}

.jspcv-grammar-ghost[data-grammar-status="checking"] .jspcv-grammar-ghost-content > * {
    display: none;
}

.jspcv-inline-sentence-suggestion {
    color: var(--theme-assist-ghost-text);
    -webkit-text-fill-color: var(--theme-assist-ghost-text);
    font: inherit;
    font-style: italic;
    font-weight: 400;
    overflow-wrap: anywhere;
    pointer-events: none;
    white-space: pre-wrap;
    word-break: break-word;
}

.jspcv-inline-sentence-suggestion[data-grammar-status="guidance"],
.jspcv-inline-sentence-suggestion[data-grammar-status="unchanged"] {
    font-style: normal;
}

.jspcv-board-table-assistance {
    box-sizing: border-box;
    display: block;
    margin: 0.35rem 0 0;
    color: var(--theme-assist-ghost-text);
    -webkit-text-fill-color: var(--theme-assist-ghost-text);
    font: inherit;
    font-style: italic;
    line-height: inherit;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.jspcv-board-table-assistance[data-grammar-status="checking"],
.jspcv-board-table-assistance[data-grammar-status="unchanged"] {
    font-style: normal;
}

.jspcv-board-table-assistance.is-cell-review {
    display: grid;
    gap: 0.35rem;
    font-style: normal;
}

.jspcv-board-table-assistance-grid {
    display: grid;
    grid-template-columns: repeat(
        var(--jspcv-table-review-columns, 1),
        minmax(0, 1fr)
    );
    gap: 0.3rem;
    min-width: 0;
}

.jspcv-board-table-assistance-cell {
    box-sizing: border-box;
    min-width: 0;
    padding: 0.25rem 0.4rem;
    overflow-wrap: anywhere;
    border: 1px solid var(--theme-border, currentColor);
    border-radius: 0.3rem;
    background: var(--theme-surface-subtle, transparent);
    color: var(--theme-assist-ghost-text);
    -webkit-text-fill-color: var(--theme-assist-ghost-text);
    font: inherit;
    font-style: italic;
    white-space: pre-wrap;
}

.jspcv-board-table-assistance-cell[data-grammar-status="unchanged"] {
    font-style: normal;
}

.jspcv-board-table-assistance-apply {
    justify-self: end;
    font: inherit;
    font-style: normal;
}

.jspcv-code-line-assistance {
    position: absolute;
    z-index: 0;
    top: 0;
    left: 0;
    box-sizing: border-box;
    width: 100%;
    min-height: 100%;
    margin: 0;
    padding: 12px var(--resources-preview-inline-padding, 12px);
    overflow: hidden;
    border: 0;
    /* The existing syntax-highlight layer remains visible beneath this marker layer. */
    background: transparent;
    color: var(--theme-code-text);
    font-family: var(--resources-code-font-family, monospace);
    font-size: var(--resources-code-display-font-size, 14px);
    font-weight: 400;
    line-height: var(--resources-content-line-height, 1.5);
    pointer-events: none;
    tab-size: 4;
    white-space: pre;
}

.jspcv-code-line-assistance code {
    display: block;
    min-width: max-content;
    margin: 0;
    padding: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    white-space: inherit;
}

.jspcv-code-line-source {
    /* Fallback only: the primary path inserts the marker into the syntax-highlight tree. */
    color: var(--theme-code-text);
    -webkit-text-fill-color: var(--theme-code-text);
}

.jspcv-code-line-marker,
.jspcv-code-line-text {
    color: var(--theme-assist-ghost-text);
    -webkit-text-fill-color: var(--theme-assist-ghost-text);
    font: inherit;
}

.jspcv-code-line-marker[data-grammar-status="suggestion"] .jspcv-code-line-text {
    font-style: italic;
}

.jspcv-inline-sentence-checking {
    display: inline-block;
    width: 0.85em;
    height: 0.85em;
    margin-left: 0;
    border: 2px solid var(--theme-text-subtle);
    border-right-color: transparent;
    border-radius: 50%;
    vertical-align: -0.08em;
    animation: jspcv-assist-clock 0.75s linear infinite;
}

.jspcv-mobile-board-suggestion-actions {
    display: none;
}

@media (max-width: 900px) {
    .jspcv-mobile-board-suggestion-actions {
        display: inline-flex;
        gap: 4px;
        margin-inline-start: 6px;
        pointer-events: auto;
        vertical-align: middle;
    }

    .jspcv-mobile-board-suggestion-action {
        box-sizing: border-box;
        display: inline-grid;
        width: 26px;
        height: 26px;
        margin: 0;
        padding: 4px;
        border: 1px solid var(--theme-border-soft);
        border-radius: 4px;
        background: var(--theme-surface-muted);
        cursor: pointer;
        pointer-events: auto;
        place-items: center;
        touch-action: manipulation;
    }

    .jspcv-mobile-board-suggestion-action:is(:hover, :focus-visible) {
        border-color: var(--theme-focus-ring);
        background: var(--theme-surface-hover);
    }

    .jspcv-mobile-board-suggestion-action:focus-visible {
        outline: 2px solid var(--theme-focus-ring);
        outline-offset: 1px;
    }

    .jspcv-mobile-board-suggestion-action:active {
        background: var(--theme-accent-surface-strong);
    }

    .jspcv-mobile-board-suggestion-action:disabled {
        cursor: not-allowed;
        opacity: 0.45;
    }

    .jspcv-mobile-board-suggestion-action-icon {
        display: block;
        width: 16px;
        height: 16px;
        background: var(--theme-success);
        -webkit-mask: var(--jspcv-mobile-board-suggestion-icon) center / contain no-repeat;
        mask: var(--jspcv-mobile-board-suggestion-icon) center / contain no-repeat;
    }

    .jspcv-mobile-board-suggestion-action--dismiss .jspcv-mobile-board-suggestion-action-icon {
        background: var(--theme-error-text);
    }
}

@keyframes jspcv-assist-clock {
    to { transform: rotate(360deg); }
}

.jspcv-grammar-assist-live {
    position: fixed;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (prefers-reduced-motion: reduce) {
    .jspcv-grammar-ghost,
    .jspcv-grammar-ghost * {
        transition: none !important;
    }

    .jspcv-grammar-ghost[data-grammar-status="checking"] .jspcv-grammar-ghost-content::after {
        animation-duration: 1.8s;
    }

    .jspcv-inline-sentence-checking {
        animation-duration: 1.8s;
    }
}
