.hcleaner {
    --hcleaner-border: #d7dce6;
    --hcleaner-border-strong: #bdc6d6;
    --hcleaner-muted: #657086;
    --hcleaner-text: #182033;
    --hcleaner-surface: #ffffff;
    --hcleaner-soft: #f6f8fc;
    --hcleaner-primary: #4f5fb5;
    --hcleaner-primary-hover: #3e4d9b;
    --hcleaner-focus: #3159c8;
    --hcleaner-success: #176b3a;
    --hcleaner-warning: #8a5b00;
    --hcleaner-error: #b42318;
    --hcleaner-radius: 12px;
    font-family: inherit;
    color: var(--hcleaner-text);
    background: var(--hcleaner-surface);
    border: 1px solid var(--hcleaner-border);
    border-radius: var(--hcleaner-radius);
    padding: clamp(14px, 2vw, 24px);
    box-sizing: border-box;
    max-width: 100%;
}

.hcleaner *, .hcleaner *::before, .hcleaner *::after { box-sizing: border-box; }
.hcleaner button, .hcleaner input, .hcleaner select, .hcleaner textarea { font: inherit; }
.hcleaner button { cursor: pointer; }
.hcleaner button:disabled, .hcleaner input:disabled, .hcleaner select:disabled { cursor: not-allowed; opacity: .55; }
.hcleaner h3 { margin: 0; font-size: 1rem; line-height: 1.35; }

.hcleaner__topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 16px;
}

.hcleaner__topbar-copy { min-width: 0; }
.hcleaner__title { margin: 0 0 4px; font-size: clamp(1.3rem, 2vw, 1.72rem); line-height: 1.2; font-weight: 800; }
.hcleaner__subtitle { margin: 0 0 5px; color: var(--hcleaner-muted); font-size: .95rem; }
.hcleaner__privacy { margin: 0; color: var(--hcleaner-muted); font-size: .86rem; max-width: 760px; }
.hcleaner__preset-label { display: grid; gap: 6px; min-width: 220px; font-weight: 700; font-size: .88rem; }
.hcleaner__preset,
.hcleaner__find-replace input,
.hcleaner__utility input[type="text"],
.hcleaner__utility select {
    min-height: 40px;
    width: 100%;
    border: 1px solid var(--hcleaner-border);
    border-radius: 7px;
    background: #fff;
    padding: 7px 9px;
    color: inherit;
}

.hcleaner__workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
    align-items: stretch;
}

.hcleaner__panel {
    min-width: 0;
    border: 1px solid var(--hcleaner-border-strong);
    border-radius: 9px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 2px rgba(20, 32, 58, .03);
}

.hcleaner__panel-header {
    min-height: 46px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 9px 11px;
    background: var(--hcleaner-soft);
    border-bottom: 1px solid var(--hcleaner-border);
}

.hcleaner__panel-header > div { min-width: 0; display: grid; gap: 1px; }
.hcleaner__panel-header strong { font-weight: 800; }
.hcleaner__panel-note { color: var(--hcleaner-muted); font-size: .75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hcleaner__count { color: var(--hcleaner-muted); font-size: .76rem; text-align: right; white-space: nowrap; }

.hcleaner__toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 3px;
    padding: 7px;
    min-height: 48px;
    border-bottom: 1px solid var(--hcleaner-border);
    background: #fff;
}

.hcleaner__tool,
.hcleaner__icon-button {
    appearance: none;
    border: 1px solid transparent;
    background: transparent;
    color: #26324a;
    border-radius: 5px;
    min-width: 32px;
    height: 32px;
    padding: 4px 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.hcleaner__tool:hover,
.hcleaner__icon-button:hover { background: #eef2f8; border-color: #d7ddea; }
.hcleaner__tool--text { font-family: Georgia, serif; font-size: 16px; }
.hcleaner__toolbar-separator { width: 1px; height: 24px; background: var(--hcleaner-border); margin: 0 3px; }
.hcleaner__format-select { height: 32px; min-width: 98px; max-width: 128px; border: 1px solid var(--hcleaner-border); border-radius: 5px; background: #fff; color: inherit; padding: 3px 6px; font-size: .82rem; }

.hcleaner__visual-frame {
    display: block;
    width: 100%;
    height: var(--hcleaner-editor-height, 500px);
    min-height: 300px;
    border: 0;
    background: #fff;
}

.hcleaner__source-wrap {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    height: calc(var(--hcleaner-editor-height, 500px) + 48px);
    min-height: 348px;
    background: #fff;
}

.hcleaner__line-numbers {
    margin: 0;
    padding: 12px 8px 12px 4px;
    border-right: 1px solid #e3e7ee;
    background: #f7f8fb;
    color: #8992a4;
    text-align: right;
    overflow: hidden;
    user-select: none;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 13px;
    line-height: 1.55;
    white-space: pre;
}

.hcleaner__source-editor {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 0;
    resize: none;
    border: 0;
    border-radius: 0;
    outline: none;
    padding: 12px;
    background: #fff;
    color: #182033;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 13px;
    line-height: 1.55;
    white-space: pre;
    overflow: auto;
    tab-size: 2;
}

.hcleaner__source-editor:focus { box-shadow: inset 0 0 0 2px var(--hcleaner-focus); }
.hcleaner__panel-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    min-height: 50px;
    padding: 8px 10px;
    border-top: 1px solid var(--hcleaner-border);
    background: #fff;
}

.hcleaner__panel-actions--source .hcleaner__button--clean { margin-left: auto; }
.hcleaner__sync-status { margin-left: auto; color: var(--hcleaner-muted); font-size: .78rem; }

.hcleaner__button {
    appearance: none;
    border: 1px solid transparent;
    border-radius: 7px;
    min-height: 36px;
    padding: 7px 11px;
    font-weight: 700;
    line-height: 1.2;
}

.hcleaner__button:focus-visible,
.hcleaner__tool:focus-visible,
.hcleaner__icon-button:focus-visible,
.hcleaner input:focus-visible,
.hcleaner select:focus-visible,
.hcleaner textarea:focus-visible,
.hcleaner summary:focus-visible {
    outline: 3px solid rgba(49, 89, 200, .24);
    outline-offset: 2px;
}

.hcleaner__button--quiet { background: #fff; border-color: var(--hcleaner-border); color: inherit; }
.hcleaner__button--quiet:hover { background: var(--hcleaner-soft); }
.hcleaner__button--secondary { background: #eef2ff; border-color: #cbd4ff; color: #2f438f; }
.hcleaner__button--secondary:hover { background: #e2e8ff; }
.hcleaner__button--primary { background: var(--hcleaner-primary); color: #fff; min-width: 130px; }
.hcleaner__button--primary:hover { background: var(--hcleaner-primary-hover); }

.hcleaner__below-grid {
    display: grid;
    grid-template-columns: minmax(0, .85fr) minmax(320px, 1.15fr);
    gap: 16px;
    margin-top: 16px;
    align-items: start;
}

.hcleaner__box {
    border: 1px solid var(--hcleaner-border);
    border-radius: 9px;
    background: #fff;
    padding: 14px;
}

.hcleaner__options { margin: 0; }
.hcleaner__options legend { padding: 0 6px; font-weight: 800; }
.hcleaner__option-grid { display: grid; grid-template-columns: 1fr; gap: 8px; }
.hcleaner__option { display: flex; align-items: flex-start; gap: 8px; line-height: 1.35; font-size: .9rem; }
.hcleaner__option input { margin-top: 2px; width: 17px; height: 17px; flex: 0 0 auto; }
.hcleaner__table-options { display: grid; gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--hcleaner-border); font-size: .88rem; }
.hcleaner__table-options label { display: flex; gap: 8px; align-items: flex-start; }
.hcleaner__subheading { font-weight: 800; }
.hcleaner__advanced { margin-top: 12px; border: 1px solid var(--hcleaner-border); border-radius: 7px; background: #fff; }
.hcleaner__advanced summary { cursor: pointer; padding: 10px 11px; font-weight: 750; }
.hcleaner__option-grid--advanced { padding: 0 11px 11px; }

.hcleaner__side-stack { display: grid; gap: 14px; }
.hcleaner__utility h3,
.hcleaner__find-replace h3 { margin-bottom: 10px; }
.hcleaner__color-row { display: grid; grid-template-columns: 48px minmax(120px, 1fr) auto; gap: 9px; align-items: center; }
.hcleaner__color-row input[type="color"] { width: 48px; height: 40px; border: 1px solid var(--hcleaner-border); border-radius: 6px; padding: 2px; background: #fff; }

.hcleaner__box-heading-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.hcleaner__replace-rows { display: grid; gap: 9px; }
.hcleaner__replace-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 34px; gap: 8px; align-items: end; }
.hcleaner__replace-row label { display: grid; gap: 5px; font-weight: 650; font-size: .82rem; }
.hcleaner__remove-row { margin-bottom: 3px; color: #8c2531; }
.hcleaner__replace-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.hcleaner__hint { color: var(--hcleaner-muted); font-size: .8rem; }

.hcleaner__lorem-grid { display: grid; grid-template-columns: minmax(100px, .6fr) minmax(160px, 1fr) auto; gap: 9px; align-items: end; }
.hcleaner__lorem-grid label { display: grid; gap: 5px; font-weight: 650; font-size: .82rem; }

.hcleaner__preview { margin-top: 16px; border: 1px solid var(--hcleaner-border); border-radius: 9px; overflow: hidden; }
.hcleaner__preview-header { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 11px; background: var(--hcleaner-soft); border-bottom: 1px solid var(--hcleaner-border); }
.hcleaner__preview iframe { display: block; width: 100%; min-height: 360px; border: 0; background: #fff; }
.hcleaner__message { min-height: 24px; margin-top: 11px; font-size: .88rem; }
.hcleaner__message[data-type="success"] { color: var(--hcleaner-success); }
.hcleaner__message[data-type="warning"] { color: var(--hcleaner-warning); }
.hcleaner__message[data-type="error"] { color: var(--hcleaner-error); }
.hcleaner__noscript { padding: 10px 12px; background: #fff1f0; border-radius: 8px; }

@media (max-width: 980px) {
    .hcleaner__workspace,
    .hcleaner__below-grid { grid-template-columns: 1fr; }
    .hcleaner__source-wrap { height: var(--hcleaner-editor-height, 500px); }
}

@media (max-width: 720px) {
    .hcleaner__topbar { flex-direction: column; }
    .hcleaner__preset-label { width: 100%; min-width: 0; }
    .hcleaner__replace-row { grid-template-columns: 1fr 1fr 34px; }
    .hcleaner__lorem-grid { grid-template-columns: 1fr 1fr; }
    .hcleaner__lorem-grid .hcleaner__button { grid-column: 1 / -1; }
}

@media (max-width: 520px) {
    .hcleaner { padding: 10px; border-radius: 8px; }
    .hcleaner__panel-header { align-items: flex-start; flex-direction: column; }
    .hcleaner__count { text-align: left; }
    .hcleaner__visual-frame,
    .hcleaner__source-wrap { height: min(var(--hcleaner-editor-height, 500px), 420px); }
    .hcleaner__source-wrap { grid-template-columns: 38px minmax(0, 1fr); }
    .hcleaner__line-numbers { padding-right: 6px; font-size: 12px; }
    .hcleaner__source-editor { font-size: 12px; }
    .hcleaner__toolbar { max-height: 116px; overflow-y: auto; }
    .hcleaner__replace-row { grid-template-columns: 1fr 34px; }
    .hcleaner__replace-row label { grid-column: 1 / 2; }
    .hcleaner__replace-row .hcleaner__remove-row { grid-column: 2 / 3; grid-row: 1 / 3; align-self: center; }
    .hcleaner__color-row { grid-template-columns: 48px minmax(0, 1fr); }
    .hcleaner__color-row .hcleaner__button { grid-column: 1 / -1; }
    .hcleaner__lorem-grid { grid-template-columns: 1fr; }
    .hcleaner__lorem-grid .hcleaner__button { grid-column: auto; }
    .hcleaner__panel-actions--source .hcleaner__button--clean { margin-left: 0; width: 100%; }
    .hcleaner__sync-status { width: 100%; margin-left: 0; }
}
