.settings-panel {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    z-index: 2000;
	width: max-content;
    max-width: calc(100vw - 24px);
    padding: 14px;
    border: 1px solid #30343b;
    border-radius: 10px;
    background: #191c21;
    color: #e1e3e8;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.35);
    user-select: none;
}

.settings-panel[hidden] {
    display: none;
}

.settings-wrapper {
    position: relative;
}

.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    color: #c8cdd5;
    font-size: 12px;
    font-weight: 600;
}

.settings-header button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    margin: 0;
    padding: 0;
    border: 1px solid #353a42;
    border-radius: 6px;
    background: transparent;
    color: #a6abb5;
    font-family: inherit;
    font-size: 18px;
    font-weight: 400;
    line-height: 1;
    cursor: pointer;
}

.settings-header button:hover {
    background: #25282e;
    border-color: #464c56;
    color: #eceef2;
}

.settings-columns {
    display: grid;
    grid-template-columns: max-content max-content max-content;
    gap: 14px;
    align-items: stretch;
}

.settings-column {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.settings-font,
.settings-nuke {
    border-right: 1px solid #2b2e34;
    padding-right: 14px;
}

.settings-section-title {
    margin-bottom: 8px;
    color: #a6abb5;
    font-size: 11px;
    font-weight: 600;
}

.category-settings {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.category-settings label {
    display: flex;
    align-items: center;
    min-height: 20px;
    padding: 0 8px;
    border: 1px solid transparent;
    border-radius: 6px;
    color: #a6abb5;
    font-size: 11px;
    cursor: pointer;
}

.category-settings label:hover {
    background: #25282e;
    border-color: #464c56;
    color: #eceef2;
}

.category-settings input {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    margin: 0 8px 0 0;
    accent-color: #4ade80;
    cursor: pointer;
}

.nuke-settings {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
}

.nuke-settings .badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 20px;
    padding: 0 8px;
    border: 1px solid #353a42;
    border-radius: 5px;
    background: transparent;
    color: #a6abb5;
    font-family: inherit;
    font-size: 10px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    opacity: 0.55;
    transition:
        opacity 0.15s ease,
        background 0.15s ease,
        border-color 0.15s ease;
}

.nuke-settings .badge:hover {
    opacity: 0.85;
}

.nuke-settings .badge[aria-pressed="true"] {
    opacity: 1;
}

.nuke-settings .badge-nuked[aria-pressed="true"] {
    border-color: #b91c1c;
    background: #7f1d1d;
    color: #fecaca;
}

.nuke-settings .badge-unnuked[aria-pressed="true"] {
    border-color: #15803d;
    background: #14532d;
    color: #bbf7d0;
}

.settings-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #2b2e34;
}

.settings-footer button {
    height: 26px;
    padding: 0 10px;
    border: 1px solid #353a42;
    border-radius: 6px;
    background: transparent;
    color: #a6abb5;
    font-family: inherit;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
}

.settings-footer button:hover {
    background: #25282e;
    border-color: #464c56;
    color: #eceef2;
}

.font-settings {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.font-option {
    display: flex;
    align-items: center;
    min-height: 20px;
    min-width: 0;
    padding: 0 8px;
    border: 1px solid transparent;
    border-radius: 6px;
    color: #a6abb5;
    font-size: 11px;
    cursor: pointer;
}

.font-option:hover {
    background: #25282e;
    border-color: #464c56;
    color: #eceef2;
}

.font-option:has(input:checked) {
    background: #25282e;
    border-color: #353a42;
    color: #eceef2;
}

.font-option input {
    appearance: none;
    -webkit-appearance: none;
    display: grid;
    place-content: center;
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    margin: 0 8px 0 0;
    border: 1px solid #686f79;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    transition: border-color 0.15s ease;
}

.font-option input::after {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #a6abb5;
    transform: scale(0);
    transition: transform 0.15s ease;
}

.font-option input:checked {
    border-color: #a6abb5;
}

.font-option input:checked::after {
    transform: scale(1);
}

.font-option input:focus-visible {
    outline: 2px solid #4b515b;
    outline-offset: 2px;
}

.font-option span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.font-option-mono span {
    font-family: "JetBrains Mono", monospace;
    font-size: 10px;
}

body.font-jetbrains-mono {
    font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

body.light .settings-panel {
    border-color: #bdc3cc;
    background: #e5e7eb;
    color: #252a32;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.12);
}

body.light .settings-header {
    color: #343b46;
}

body.light .settings-header button,
body.light .settings-footer button {
    border-color: #bdc3cc;
    background: transparent;
    color: #414853;
}

body.light .settings-header button:hover,
body.light .settings-footer button:hover {
    background: #d1d6de;
    border-color: #a9b0bb;
    color: #252a32;
}

body.light .settings-section-title {
    color: #626c7a;
}

body.light .settings-font {
    border-right-color: #bdc3cc;
}

body.light .category-settings label,
body.light .font-option {
    color: #414853;
}

body.light .category-settings label:hover,
body.light .font-option:hover,
body.light .font-option:has(input:checked) {
    background: #d1d6de;
    border-color: #a9b0bb;
    color: #252a32;
}

body.light .category-settings input {
    accent-color: #52525b;
}

body.light .settings-nuke {
    border-right-color: #bdc3cc;
}

body.light .nuke-settings .badge {
    border-color: #bdc3cc;
    color: #414853;
}

body.light .nuke-settings .badge-nuked[aria-pressed="true"] {
    border-color: #dc2626;
    background: #fee2e2;
    color: #991b1b;
}

body.light .nuke-settings .badge-unnuked[aria-pressed="true"] {
    border-color: #16a34a;
    background: #dcfce7;
    color: #166534;
}

body.light .settings-footer {
    border-top-color: #bdc3cc;
}

body.light .font-option input {
    border-color: #a9b0bb;
}

body.light .font-option input:checked {
    border-color: #52525b;
}

body.light .font-option input::after {
    background: #52525b;
}

body.light .font-option input:focus-visible {
    outline-color: #858e9b;
}

@media (max-width: 440px) {
    .settings-panel {
        padding: 12px;
    }

	.settings-columns {
		grid-template-columns: max-content max-content max-content;
		gap: 10px;
	}

	.settings-footer {
		display: flex;
		align-items: center;
		justify-content: flex-start;
		flex-wrap: wrap;
		gap: 6px;
		margin-top: 12px;
		padding-top: 10px;
		border-top: 1px solid #2b2e34;
	}

    .settings-footer button {
        padding: 0 6px;
        font-size: 9px;
    }

    .font-option {
        padding: 0 5px;
    }

    .font-option input {
        margin-right: 5px;
    }
}