mark.hpbspellcheck-error {
    background: #ffd2d2 !important;
    color: inherit !important;
    border-radius: 2px;
    box-shadow: inset 0 -2px 0 #c80000;
    cursor: help;
    padding: 0 1px;
    text-decoration: underline wavy #c80000;
    text-decoration-thickness: 1.5px;
    text-underline-offset: 2px;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
}

mark.hpbspellcheck-error:focus {
    outline: 3px solid rgba(200, 0, 0, 0.35);
    outline-offset: 2px;
}

.hpbspellcheck-ui,
.hpbspellcheck-ui * {
    box-sizing: border-box;
}

.hpbspellcheck-toolbar {
    position: fixed;
    z-index: 2147483000;
    width: min(340px, calc(100vw - 24px));
    overflow: hidden;
    color: #172238;
    background: #fff;
    border: 1px solid rgba(23, 34, 56, 0.15);
    border-radius: 12px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.2);
    font: 14px/1.45 Arial, Helvetica, sans-serif;
    text-align: left;
}

.hpbspellcheck-bottom-right { right: 16px; bottom: 16px; }
.hpbspellcheck-bottom-left { left: 16px; bottom: 16px; }
.hpbspellcheck-top-right { right: 16px; top: 16px; }
.hpbspellcheck-top-left { left: 16px; top: 16px; }

.hpbspellcheck-toolbar__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 42px;
    padding: 8px 12px;
    color: #fff;
    background: #1c57b7;
}

.hpbspellcheck-toolbar__header strong {
    color: inherit;
    font-size: 15px;
}

.hpbspellcheck-toolbar__minimise,
.hpbspellcheck-tooltip__close {
    appearance: none;
    border: 0;
    background: transparent;
    cursor: pointer;
    font: 700 24px/1 Arial, Helvetica, sans-serif;
}

.hpbspellcheck-toolbar__minimise {
    color: #fff;
    width: 30px;
    height: 30px;
}

.hpbspellcheck-toolbar__body {
    padding: 12px;
}

.hpbspellcheck-toolbar.is-collapsed .hpbspellcheck-toolbar__body {
    display: none;
}

.hpbspellcheck-toolbar.is-collapsed .hpbspellcheck-toolbar__minimise {
    transform: rotate(45deg);
}

.hpbspellcheck-status {
    min-height: 40px;
    margin: 0 0 10px;
    padding: 8px 10px;
    border-radius: 6px;
    background: #f1f4f8;
}

.hpbspellcheck-status[data-type="success"] { background: #e4f6e8; color: #155724; }
.hpbspellcheck-status[data-type="warning"] { background: #fff1d2; color: #6d4600; }
.hpbspellcheck-status[data-type="error"] { background: #ffe0e0; color: #8d0000; }

.hpbspellcheck-actions {
    display: grid;
    gap: 8px;
}

.hpbspellcheck-button {
    appearance: none;
    min-height: 40px;
    padding: 8px 12px;
    border: 1px solid #b7c1ce;
    border-radius: 6px;
    color: #172238;
    background: #fff;
    cursor: pointer;
    font: 700 14px/1.2 Arial, Helvetica, sans-serif;
}

.hpbspellcheck-button--primary {
    border-color: #1c57b7;
    color: #fff;
    background: #1c57b7;
}

.hpbspellcheck-button:hover:not(:disabled) {
    filter: brightness(0.94);
}

.hpbspellcheck-button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.hpbspellcheck-attribution {
    display: inline-block;
    margin-top: 10px;
    color: #1c57b7;
    font-size: 12px;
    text-decoration: underline;
}

.hpbspellcheck-is-busy .hpbspellcheck-toolbar__header::before {
    content: '';
    width: 16px;
    height: 16px;
    margin-right: 8px;
    border: 2px solid rgba(255,255,255,.45);
    border-top-color: #fff;
    border-radius: 50%;
    animation: hpbspellcheck-spin .8s linear infinite;
}

.hpbspellcheck-tooltip {
    position: fixed;
    z-index: 2147483646;
    width: min(380px, calc(100vw - 20px));
    padding: 16px;
    color: #172238;
    background: #fff;
    border: 1px solid #d1d8e1;
    border-top: 4px solid #c80000;
    border-radius: 8px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.24);
    font: 14px/1.45 Arial, Helvetica, sans-serif;
}

.hpbspellcheck-tooltip__close {
    position: absolute;
    top: 6px;
    right: 8px;
    color: #5c6675;
}

.hpbspellcheck-tooltip__message {
    margin: 0 30px 12px 0;
    font-weight: 700;
}

.hpbspellcheck-tooltip__suggestions strong {
    display: block;
    margin-bottom: 6px;
}

.hpbspellcheck-tooltip__suggestions div {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.hpbspellcheck-tooltip__suggestions span {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 999px;
    color: #0f3f88;
    background: #e6efff;
}

.hpbspellcheck-tooltip__empty {
    margin: 0 0 8px;
    color: #626d7c;
}

.hpbspellcheck-tooltip small {
    display: block;
    margin-top: 10px;
    color: #626d7c;
}

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

@media (max-width: 640px) {
    .hpbspellcheck-toolbar {
        right: 8px !important;
        bottom: 8px !important;
        left: 8px !important;
        top: auto !important;
        width: auto;
    }
}

@media print {
    .hpbspellcheck-ui { display: none !important; }
    mark.hpbspellcheck-error {
        background: transparent !important;
        box-shadow: none !important;
        text-decoration: none !important;
    }
}
