@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
    }
@keyframes copied {
    from { opacity: 0; }
    to { opacity: 1; }
    }

:root {
    --filtering-mode-button-size: 32px;
    }

body.loading {
    visibility: hidden;
    }
h3 {
    margin: 1em 0;
    }

label + legend {
    color: color-mix(in srgb, currentColor 69%, transparent);
    font-size: var(--font-size-smaller);
    margin-inline-start: var(--default-gap-large);
    }

body[data-forbid~="dashboard"] #dashboard-nav [data-pane="settings"],
body[data-forbid~="dashboard"] section[data-pane="settings"],
body[data-forbid~="dashboard"] #dashboard-nav [data-pane="rulesets"],
body[data-forbid~="dashboard"] section[data-pane="rulesets"],
body[data-forbid~="dashboard"] #dashboard-nav [data-pane="filters"],
body[data-forbid~="dashboard"] section[data-pane="filters"] {
    display: none;
    }
body[data-forbid~="filteringMode"] section[data-pane="settings"] > div:has(> h3[data-i18n="defaultFilteringModeSectionLabel"]),
body[data-forbid~="filteringMode"] section[data-pane="settings"] > div:has(> h3[data-i18n="filteringMode0Name"]) {
    display: none;
    }
body[data-forbid~="picker"] #dashboard-nav [data-pane="filters"],
body[data-forbid~="picker"] section[data-pane="filters"] {
    display: none;
    }
body[data-forbid~="develop"] #developerMode {
    display: none;
    }

label:has(input[type="checkbox"][disabled]),
label:has(input[type="checkbox"][disabled]) + legend {
    filter: var(--checkbox-disabled-filter);
    }

#defaultFilteringMode {
    display: grid;
    gap: 1em;
    grid: auto-flow dense / 1fr 1fr 1fr;
    }
.filteringModeCard {
    border: 1px solid var(--surface-3);
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    }
.filteringModeCard:hover {
    background-color: color-mix(in hsl, var(--surface-1) 75%, var(--surface-0) 25%);
    }
.filteringModeCard:has(.radio > [type="radio"]:checked) {
    background-color: var(--surface-0);
    }
.filteringModeCard .input.radio ~ [data-i18n] {
    text-transform: capitalize;
    }
.filteringModeCard span:has(> .input) {
    align-items: center;
    display: inline-flex;
    }
.filteringModeCard > div {
    align-items: center;
    box-sizing: border-box;
    display: flex;
    padding: 0.5em;
    width: 100%;
    }
.filteringModeCard > div:nth-of-type(2) {
    justify-content: center;
    }
.filteringModeCard > div:nth-of-type(3) {
    border-top: 1px solid var(--surface-2);
    font-size: var(--font-size-smaller);
    white-space: pre-line;
    }
.filteringModeSlider {
    pointer-events: none;
    }

h3[data-i18n="filteringMode0Name"]::first-letter {
    text-transform: capitalize;
    }

body[data-platform="safari"] [data-platform-exclude="safari"] {
    display: none;
    }

section[data-pane="settings"] p:has(button) {
    display: flex;
    flex-wrap: wrap;
    gap: 1em;
    }

body:not(.committing) #commit-spinner {
    display: none;
    }
body.committing #commit-spinner {
    animation: spin 1s steps(8) infinite;
    fill: var(--accent-surface-1);
    }
#dnrError {
    color: var(--info3-ink);
    }
#dnrError:empty {
    display: none;
    }
section[data-pane="rulesets"] > div:first-of-type > p:first-of-type {
    margin-top: 0;
    }
section[data-pane="rulesets"] > div:first-of-type > p:last-of-type {
    margin-bottom: 0;
    }
.listEntry {
    display: flex;
    flex-direction: column;
    }
.listEntry[data-nodeid] > .detailbar .listExpander {
    cursor: pointer;
    top: 2px;
    }
.listEntry[data-role="rootnode"] > .detailbar,
.listEntry[data-nodeid] > .detailbar .count {
    cursor: pointer;
    }
.listEntry[data-role="rootnode"] > .detailbar > *:not(.listExpander) {
    pointer-events: none;
    }
.listEntry .detailbar .count {
    align-self: flex-end;
    color: var(--ink-3);
    font-size: small;
    pointer-events: none;
    }
.listEntries {
    display: flex;
    flex-direction: column;
    }
.listEntry:not([data-role="rootnode"]) > .listEntries {
    margin-inline-start: var(--checkbox-size);
    }
.listEntry.hideUnused > .listEntries > .listEntry:not(.isDefault):has(> .detailbar input:not(:checked)) {
    display: none;
    }
.listEntry.fromAdmin:has(> .detailbar input[disabled]:not(:checked)) {
    display: none;
    }
.listEntry > * {
    unicode-bidi: embed;
    }
.listEntry h3 {
    display: inline-block;
    margin: 0;
    }
.listEntry > .detailbar {
    align-items: center;
    display: inline-flex;
    margin: calc(var(--default-gap-xsmall) / 2 + var(--default-gap-xxsmall) / 2) 0;
    white-space: nowrap;
    }
.listEntry > .detailbar > *:not(:first-child) {
    margin-inline-start: var(--default-gap-xxsmall);
    }
.listEntry[data-nodeid="default"] > .detailbar > .listExpander {
    display: none;
    }
.listEntry > .detailbar > .listExpander svg {
    transform: rotate(180deg);
    transform-origin: 50%;
    }
.listEntry.hideUnused > .detailbar > .listExpander svg {
    transform: rotate(90deg);
    }
.listEntry .checkbox:has(input[disabled]),
.listEntry .checkbox:has(input[disabled]) ~ span {
    filter: var(--checkbox-disabled-filter);
    }
.listEntry a,
.listEntry .fa-icon {
    color: var(--info0-ink);
        fill: var(--info0-ink);
    font-size: 120%;
    }
.listEntry .fa-icon:hover {
    transform: scale(1.25);
    }
.listEntry .iconbar a.support[href="#"] {
    display: none;
    }

body.noMoreRuleset .listEntry:has(> .detailbar input:not(:checked)) {
    opacity: 0.5;
    pointer-events: none;
}

#lists.searchMode > .listEntries .listEntries,
#lists.searchMode > .listEntries .listEntry.searchMatch {
    display: flex !important;
    }
#lists.searchMode > .listEntries .listEntry {
    display: none;
    }
#lists.searchMode > .listEntries .listExpander {
    visibility: hidden;
    }

/* touch-screen devices */
:root.mobile .listEntry .fa-icon {
    font-size: 120%;
    margin: 0 0.5em 0 0;
    }
:root.mobile .listEntries {
    margin-inline-start: 0;
    -webkit-margin-start: 0;
    }
:root.mobile .li.listEntry {
    overflow-x: auto;
    }
:root.mobile .li.listEntry label > span:not([class]) {
    flex-grow: 1;
    }
:root.mobile .li.listEntry .listname,
:root.mobile .li.listEntry .iconbar {
    align-items: flex-start;
    display: flex;
    white-space: nowrap;
    }
:root.mobile .li.listEntry .iconbar {
    margin-top: 0.2em;
    }

body section[data-pane="filters"] {
    padding-inline: 0;
    }
body section[data-pane="filters"] .hostnames {
    border-bottom: 1px solid var(--border-1);
    margin-block-start: 1em;
    }
body section[data-pane="filters"] .hostnames:empty {
    display: none;
    }
body.readonly section[data-pane="filters"] .hostnames {
    pointer-events: none;
    }
section[data-pane="filters"] ul {
    list-style: none;
    margin: 0;
    padding-inline-start: 0;
    }
section[data-pane="filters"] li[data-pretty] > div {
    padding-inline-start: 0.5em;
    }
section[data-pane="filters"] li.hostname > div {
    background-color: var(--surface-2);
    }
section[data-pane="filters"] ul ul {
    padding-block-end: 1em;
    padding-inline-start: 0.5em;
    }
section[data-pane="filters"] li > div {
    display: flex;
    padding-block: 4px;
    }
section[data-pane="filters"] li [contenteditable] {
    flex-grow: 1;
    word-break: break-all;
    }
section[data-pane="filters"] li [contenteditable]:focus {
    background-color: var(--surface-0);
    }
section[data-pane="filters"] li > div span.fa-icon {
    align-self: baseline;
    font-size: calc(var(--font-size) + 2px);
    padding-inline: 0.3em;
    top: 2px;
    }
section[data-pane="filters"] li > div span.remove,
section[data-pane="filters"] li > div span.undo {
    padding-inline-end: 0.5em;
    }
section[data-pane="filters"] li.selector:not(:first-of-type) {
    border-top: 1px dotted var(--border-1);
    }
section[data-pane="filters"] li.removed > div [contenteditable] {
    color: red;
    text-decoration-line: line-through;
    }
section[data-pane="filters"] li.removed > div span.copy,
section[data-pane="filters"] li.removed > div span.remove,
section[data-pane="filters"] li:not(.removed) > div span.undo {
    display: none;
    }
section[data-pane="filters"] li > div span.copy.copied {
    animation: copied 1s ease-out;
}
section[data-pane="filters"] span[contenteditable]:empty:not(:focus)::before {
    color: gray;
    content: '\2026';
}
section[data-pane="filters"] span[contenteditable]:empty ~ * {
    display: none;
}
html.desktop section[data-pane="filters"] li > div:hover {
    background-color: var(--surface-0);
    }
html.desktop section[data-pane="filters"] li > div span.fa-icon:hover {
    transform: scale(1.3);
    }
section[data-pane="filters"] aside details {
    padding: 1em 0;
    }
section[data-pane="filters"] aside summary {
    cursor: default;
    line-height: 2;
    }
section[data-pane="filters"] aside .importFromText {
    color: var(--ink-2);
    }
section[data-pane="filters"] aside textarea {
    background-color: var(--surface-1);
    border: 1px solid var(--border-1);
    box-sizing: border-box;
    min-height: 6em;
    resize: vertical;
    width: 100%;
    }
section[data-pane="filters"] aside textarea:focus {
    background-color: var(--surface-0);
    }
section[data-pane="filters"] aside .importFromText:has(textarea:placeholder-shown) button:has([data-i18n="addButton"]) {
    display: none;
    }
section[data-pane="filters"] aside .importFromText:not(:has(textarea:placeholder-shown)) button:has([data-i18n="importAndAppendButton"]),
section[data-pane="filters"] aside .importFromText:not(:has(textarea:placeholder-shown)) button:has([data-i18n="exportButton"]) {
    display: none;
    }
section[data-pane="filters"] aside p {
    display: flex;
    flex-wrap: wrap;
    gap: 1em;
    }
section[data-pane="filters"] li.error[data-pretty] > div span[contenteditable] {
    color: var(--info3-ink);
    }
body:not([data-supports~="user-scripts"]) section[data-pane="filters"] aside#sandboxEditor {
    display: none;
    }
section[data-pane="filters"] aside#sandboxEditor .cm-scroller {
    max-height: 480px;
    }
body:not([data-develop="true"]) section[data-pane="filters"] aside#sandboxEditor {
    display: none;
    }

@media (max-width: 480px) {
    #defaultFilteringMode {
        grid: 1fr 1fr 1fr / auto-flow dense;
    }
    .filteringModeCard > div:nth-of-type(2) {
        justify-content: flex-start;
    }
}

body.busy section[data-pane="busy"]  > div {
    justify-content: center;
    display: flex;
    align-items: stretch;
}
body.busy section[data-pane="busy"] .fa-icon {
    animation: spin 1s steps(8) infinite;
    fill: var(--surface-3);
    font-size: 4em;
    margin: 2em;
}