.hueroll-tool,
.hueroll-mypalette {
	--hueroll-border: #c8cdd5;
	--hueroll-surface: #ffffff;
	--hueroll-surface-muted: #f4f6f8;
	--hueroll-text: #17202a;
	--hueroll-text-muted: #52606d;
	--hueroll-accent: #2457d6;
	--hueroll-focus: #ffbf47;
	box-sizing: border-box;
	color: var(--hueroll-text);
	font: inherit;
	margin-block: 1.5rem;
}

.hueroll-tool *,
.hueroll-tool *::before,
.hueroll-tool *::after,
.hueroll-mypalette *,
.hueroll-mypalette *::before,
.hueroll-mypalette *::after {
	box-sizing: border-box;
}

.hueroll-tool {
	container: hueroll / inline-size;
}

.hueroll-tool h2,
.hueroll-tool h3,
.hueroll-tool h4,
.hueroll-tool h5,
.hueroll-mypalette h2,
.hueroll-mypalette .hueroll-clear-dialog h3 {
	font-family: inherit;
	line-height: 1.25;
	margin: 0 0 0.75rem;
}

.hueroll-tool button,
.hueroll-tool input,
.hueroll-mypalette button {
	font: inherit;
}

.hueroll-tool [hidden],
.hueroll-mypalette [hidden] {
	display: none;
}

.hueroll-tool .hueroll-tool__header {
	margin-bottom: 1rem;
}

.hueroll-tool .hueroll-palette-grid {
	display: grid;
	gap: 2px;
	grid-template-columns: repeat(16, minmax(44px, 1fr));
	width: 100%;
}

.hueroll-tool .hueroll-swatch,
.hueroll-mypalette .hueroll-saved-color,
.hueroll-tool .hueroll-color-button,
.hueroll-tool .hueroll-ratio-color {
	appearance: none;
	border: 1px solid rgb(0 0 0 / 22%);
	border-radius: 0.25rem;
	box-shadow: none;
	cursor: pointer;
	font-weight: 700;
	line-height: 1;
	margin: 0;
	min-height: 44px;
	overflow: hidden;
	position: relative;
	text-align: center;
	text-decoration: none;
	white-space: nowrap;
}

.hueroll-tool .hueroll-swatch {
	aspect-ratio: 1;
	font-size: clamp(0.54rem, 1.3cqi, 0.72rem);
	min-width: 0;
	padding: 2px;
}

.hueroll-tool .hueroll-swatch[aria-pressed="true"] {
	border-color: #ffffff;
	box-shadow: 0 0 0 3px #17202a;
	z-index: 1;
}

.hueroll-tool .hueroll-swatch[aria-pressed="true"]::after {
	align-items: center;
	background: var(--hueroll-surface);
	border: 1px solid currentColor;
	border-radius: 50%;
	color: var(--hueroll-text);
	content: "✓";
	display: flex;
	font-size: 0.7rem;
	height: 1.1rem;
	justify-content: center;
	position: absolute;
	right: 2px;
	top: 2px;
	width: 1.1rem;
}

.hueroll-mypalette .hueroll-mypalette__frame {
	margin-bottom: 0.75rem;
}

.hueroll-mypalette .hueroll-mypalette__colors {
	display: grid;
	gap: 0.5rem;
	grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
}

.hueroll-mypalette .hueroll-saved-color {
	font-size: 0.75rem;
	padding: 0.65rem 0.35rem;
}

.hueroll-mypalette .hueroll-mypalette__empty {
	color: var(--hueroll-text-muted);
	margin: 0;
}

.hueroll-tool .hueroll-button,
.hueroll-tool .hueroll-color-copy,
.hueroll-mypalette .hueroll-button,
.hueroll-tool .hueroll-dialog__close {
	appearance: none;
	background: var(--hueroll-accent);
	border: 2px solid transparent;
	border-radius: 0.4rem;
	color: #ffffff;
	cursor: pointer;
	font-weight: 700;
	line-height: 1.2;
	margin: 0;
	min-height: 44px;
	padding: 0.65rem 0.9rem;
	text-decoration: none;
}

.hueroll-mypalette .hueroll-button--secondary {
	background: var(--hueroll-surface);
	border-color: var(--hueroll-accent);
	color: var(--hueroll-accent);
}

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

.hueroll-tool button:focus-visible,
.hueroll-tool input:focus-visible,
.hueroll-tool [tabindex="-1"]:focus-visible,
.hueroll-mypalette button:focus-visible,
.hueroll-mypalette [tabindex="-1"]:focus-visible {
	outline: 3px solid var(--hueroll-focus);
	outline-offset: 3px;
}

.hueroll-mypalette .hueroll-clear-dialog {
	background: transparent;
	border: 0;
	color: var(--hueroll-text);
	margin: auto;
	max-width: calc(100vw - 32px);
	padding: 0;
	width: 30rem;
}

.hueroll-mypalette .hueroll-clear-dialog::backdrop {
	background: rgb(11 18 27 / 62%);
}

.hueroll-mypalette .hueroll-clear-dialog__content {
	background: var(--hueroll-surface);
	border: 1px solid var(--hueroll-border);
	border-radius: 0.75rem;
	box-shadow: 0 1rem 2.5rem rgb(11 18 27 / 28%);
	padding: 1rem;
}

.hueroll-mypalette .hueroll-clear-dialog__content p {
	margin: 0 0 1rem;
}

.hueroll-mypalette .hueroll-clear-dialog__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	justify-content: flex-end;
}

.hueroll-tool .hueroll-dialog {
	background: transparent;
	border: 0;
	color: var(--hueroll-text);
	height: 100dvh;
	inset: 0 0 0 auto;
	margin: 0;
	max-height: 100dvh;
	max-width: none;
	overflow: hidden;
	padding: 0;
	width: min(720px, calc(100vw - 32px));
}

.hueroll-tool .hueroll-dialog::backdrop {
	background: rgb(11 18 27 / 62%);
}

.hueroll-tool .hueroll-dialog__panel {
	background: var(--hueroll-surface);
	height: 100%;
	overflow-y: auto;
	overscroll-behavior: contain;
	transform: translateX(100%);
}

.hueroll-tool .hueroll-dialog[open] .hueroll-dialog__panel {
	animation: hueroll-slide-in 180ms ease-out forwards;
}

@keyframes hueroll-slide-in {
	to {
		transform: translateX(0);
	}
}

.hueroll-tool .hueroll-dialog__header {
	align-items: center;
	background: var(--hueroll-surface);
	border-bottom: 1px solid var(--hueroll-border);
	display: grid;
	gap: 0.75rem;
	grid-template-columns: minmax(0, 1fr) auto auto;
	padding: 0.75rem 1rem;
	position: sticky;
	top: 0;
	z-index: 5;
}

.hueroll-tool .hueroll-dialog__header h2 {
	margin: 0;
}

.hueroll-tool .hueroll-dialog__close {
	align-items: center;
	background: var(--hueroll-surface-muted);
	border-color: var(--hueroll-border);
	color: var(--hueroll-text);
	display: inline-flex;
	font-size: 1.5rem;
	height: 44px;
	justify-content: center;
	padding: 0;
	width: 44px;
}

.hueroll-tool .hueroll-copy {
	align-items: stretch;
	display: flex;
	gap: 0.4rem;
}

.hueroll-tool .hueroll-copy__value {
	background: var(--hueroll-surface-muted);
	border: 1px solid var(--hueroll-border);
	border-radius: 0.4rem;
	color: var(--hueroll-text);
	font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
	font-weight: 700;
	min-height: 44px;
	padding: 0.55rem;
	width: 8.5rem;
}

.hueroll-tool .hueroll-dialog__body {
	display: grid;
	gap: 1rem;
	padding: 1rem;
}

.hueroll-tool .hueroll-section {
	background: var(--hueroll-surface);
	border: 1px solid var(--hueroll-border);
	border-radius: 0.65rem;
	padding: 1rem;
}

.hueroll-tool .hueroll-preview {
	align-items: center;
	border: 1px solid rgb(0 0 0 / 20%);
	border-radius: 0.5rem;
	display: flex;
	font-size: 1.1rem;
	font-weight: 700;
	justify-content: center;
	min-height: 12rem;
	padding: 1rem;
	text-align: center;
}

.hueroll-tool .hueroll-controls {
	display: grid;
	gap: 1rem;
	grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
	margin-block: 1rem;
}

.hueroll-tool .hueroll-field,
.hueroll-tool .hueroll-hex-form {
	display: grid;
	gap: 0.4rem;
}

.hueroll-tool .hueroll-field label,
.hueroll-tool .hueroll-hex-form label {
	font-weight: 700;
}

.hueroll-tool .hueroll-field input[type="color"] {
	background: var(--hueroll-surface);
	border: 1px solid var(--hueroll-border);
	border-radius: 0.4rem;
	cursor: pointer;
	height: 48px;
	padding: 0.2rem;
	width: 100%;
}

.hueroll-tool .hueroll-hex-form__row {
	display: flex;
	gap: 0.5rem;
}

.hueroll-tool .hueroll-hex-form__row .hueroll-button {
	flex: 0 0 auto;
	white-space: nowrap;
}

.hueroll-tool .hueroll-hex-form__row input {
	background: var(--hueroll-surface);
	border: 1px solid var(--hueroll-border);
	border-radius: 0.4rem;
	color: var(--hueroll-text);
	min-height: 44px;
	min-width: 0;
	padding: 0.55rem 0.7rem;
	width: 100%;
}

.hueroll-tool .hueroll-error {
	color: #a11b1b;
	font-weight: 700;
	margin: 0;
	min-height: 1.5em;
}

.hueroll-tool .hueroll-color-info {
	display: grid;
	gap: 1px;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	margin: 0 0 1rem;
}

.hueroll-tool .hueroll-color-info > div {
	background: var(--hueroll-surface-muted);
	display: grid;
	gap: 0.25rem;
	min-width: 0;
	padding: 0.75rem;
}

.hueroll-tool .hueroll-color-info dt {
	color: var(--hueroll-text-muted);
	font-size: 0.8rem;
	font-weight: 700;
}

.hueroll-tool .hueroll-color-info dd {
	font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
	margin: 0;
	overflow-wrap: anywhere;
}

.hueroll-tool .hueroll-color-group + .hueroll-color-group {
	border-top: 1px solid var(--hueroll-border);
	margin-top: 1rem;
	padding-top: 1rem;
}

.hueroll-tool .hueroll-color-list {
	display: grid;
	gap: 0.5rem;
	grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
}

.hueroll-tool .hueroll-color-card {
	display: grid;
	gap: 0.35rem;
	grid-template-rows: minmax(44px, auto) auto;
	min-width: 0;
}

.hueroll-tool .hueroll-color-button {
	align-items: center;
	display: flex;
	flex-direction: column;
	font-size: 0.72rem;
	justify-content: center;
	min-width: 0;
	padding: 0.55rem 0.25rem;
	width: 100%;
}

.hueroll-tool [data-hueroll-current-label] {
	display: block;
	font-size: 0.68rem;
	line-height: 1.2;
	margin-top: 0.25rem;
}

.hueroll-tool [data-hueroll-current-label][hidden] {
	display: none;
}

.hueroll-tool .hueroll-color-copy {
	font-size: 0.72rem;
	min-width: 0;
	overflow: hidden;
	padding: 0.55rem 0.35rem;
	text-overflow: ellipsis;
	white-space: nowrap;
	width: 100%;
}

.hueroll-tool .hueroll-color-button[aria-disabled="true"],
.hueroll-tool .hueroll-ratio-color[aria-disabled="true"] {
	cursor: default;
}

.hueroll-tool .hueroll-color-button[aria-pressed="true"],
.hueroll-tool .hueroll-ratio-color[aria-pressed="true"] {
	border: 3px solid #17202a;
	box-shadow: inset 0 0 0 2px #ffffff;
	z-index: 1;
}

.hueroll-tool .hueroll-color-button[aria-pressed="true"]::after,
.hueroll-tool .hueroll-ratio-color[aria-pressed="true"]::after {
	align-items: center;
	background: var(--hueroll-surface);
	border: 1px solid var(--hueroll-text);
	border-radius: 50%;
	color: var(--hueroll-text);
	content: "✓";
	display: flex;
	font-size: 0.7rem;
	height: 1.1rem;
	justify-content: center;
	position: absolute;
	right: 2px;
	top: 2px;
	width: 1.1rem;
}

.hueroll-tool .hueroll-ratio-variant + .hueroll-ratio-variant {
	margin-top: 1rem;
}

.hueroll-tool .hueroll-ratio-palette {
	display: flex;
	min-height: 7rem;
	overflow: hidden;
}

.hueroll-tool .hueroll-ratio-color {
	align-items: center;
	border-radius: 0;
	display: flex;
	flex-grow: 0;
	flex-shrink: 0;
	font-size: 0.65rem;
	justify-content: center;
	min-width: 0;
	padding: 0.25rem;
}

.hueroll-tool .hueroll-ratio-color:focus-visible {
	outline-offset: -4px;
	z-index: 2;
}

.hueroll-tool .hueroll-ratio-legend {
	display: grid;
	font-size: 0.78rem;
	gap: 0.35rem;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	list-style: none;
	margin: 0.5rem 0 0;
	padding: 0;
}

.hueroll-tool .hueroll-ratio-action {
	display: grid;
	gap: 0.35rem;
	min-width: 0;
}

.hueroll-tool .hueroll-ratio-action__label {
	font-weight: 700;
	overflow-wrap: anywhere;
}

.hueroll-tool .hueroll-ratio-action__hex {
	font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
	overflow-wrap: anywhere;
}

.hueroll-tool .hueroll-ratio-action__current {
	font-weight: 700;
}

.hueroll-tool .hueroll-copy-fallback {
	height: 1px;
	left: 0;
	opacity: 0;
	pointer-events: none;
	position: fixed;
	top: 0;
	width: 1px;
}

.hueroll-tool .hueroll-note {
	color: var(--hueroll-text-muted);
	font-size: 0.85rem;
	margin: 0.75rem 0 0;
}

.hueroll-tool .hueroll-contrast-grid {
	display: grid;
	gap: 0.75rem;
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

.hueroll-tool .hueroll-contrast-card {
	background: var(--hueroll-surface-muted);
	border: 1px solid var(--hueroll-border);
	border-radius: 0.5rem;
	padding: 0.75rem;
}

.hueroll-tool .hueroll-contrast-card p {
	font-size: 1.1rem;
	font-weight: 700;
	margin: 0;
}

.hueroll-tool .hueroll-text-samples {
	display: grid;
	gap: 0.75rem;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	margin-top: 0.75rem;
}

.hueroll-tool .hueroll-text-samples p {
	border: 1px solid rgb(0 0 0 / 20%);
	border-radius: 0.5rem;
	font-weight: 700;
	margin: 0;
	padding: 1.5rem 0.75rem;
	text-align: center;
}

.hueroll-tool .hueroll-status,
.hueroll-mypalette .hueroll-status {
	min-height: 1.5em;
}

.hueroll-tool .hueroll-dialog-status {
	background: var(--hueroll-surface);
	border-top: 1px solid var(--hueroll-border);
	font-weight: 700;
	margin: 0;
	padding: 0.75rem 1rem;
	position: sticky;
	bottom: 0;
}

.hueroll-tool .hueroll-load-status,
.hueroll-mypalette .hueroll-status {
	font-weight: 700;
	margin-bottom: 0;
}

.hueroll-tool .hueroll-noscript,
.hueroll-mypalette .hueroll-noscript {
	background: #fff4d6;
	border: 1px solid #8f6400;
	color: #382700;
	padding: 0.75rem;
}

@container hueroll (max-width: 767px) {
	.hueroll-tool .hueroll-palette-grid {
		grid-template-columns: repeat(8, minmax(44px, 1fr));
	}
}

@container hueroll (max-width: 479px) {
	.hueroll-tool .hueroll-palette-grid {
		grid-template-columns: repeat(4, minmax(44px, 1fr));
	}
}

@supports not (container-type: inline-size) {
	@media (max-width: 767px) {
		.hueroll-tool .hueroll-palette-grid {
			grid-template-columns: repeat(8, minmax(44px, 1fr));
		}
	}

	@media (max-width: 479px) {
		.hueroll-tool .hueroll-palette-grid {
			grid-template-columns: repeat(4, minmax(44px, 1fr));
		}
	}
}

@media (max-width: 767px) {
	.hueroll-tool .hueroll-dialog {
		width: 100vw;
	}

	.hueroll-tool .hueroll-dialog__header {
		grid-template-columns: minmax(0, 1fr) auto;
	}

	.hueroll-tool .hueroll-copy {
		grid-column: 1 / -1;
		grid-row: 2;
	}

	.hueroll-tool .hueroll-copy__value {
		min-width: 0;
		width: 100%;
	}

	.hueroll-tool .hueroll-dialog__close {
		grid-column: 2;
		grid-row: 1;
	}

	.hueroll-tool .hueroll-controls,
	.hueroll-tool .hueroll-color-info,
	.hueroll-tool .hueroll-contrast-grid,
	.hueroll-tool .hueroll-text-samples {
		grid-template-columns: 1fr;
	}
}

@media (max-width: 360px) {
	.hueroll-tool .hueroll-hex-form__row,
	.hueroll-tool .hueroll-copy {
		align-items: stretch;
		flex-direction: column;
	}

	.hueroll-mypalette .hueroll-clear-dialog__actions {
		align-items: stretch;
		flex-direction: column;
	}

	.hueroll-tool .hueroll-ratio-legend {
		grid-template-columns: 1fr;
	}
}

@media (prefers-reduced-motion: reduce) {
	.hueroll-tool .hueroll-dialog__panel,
	.hueroll-tool .hueroll-dialog[open] .hueroll-dialog__panel {
		animation: none;
		transform: none;
	}
}
