/**
 * Image to PNG Converter — front-end styles.
 *
 * Every selector is namespaced under .itpngc-wrap so the plugin cannot leak
 * styles into the surrounding theme, and so the theme is unlikely to leak in.
 */

.itpngc-wrap {
	--itpngc-bg: #ffffff;
	--itpngc-bg-soft: #f6f8fb;
	--itpngc-bg-sunken: #eef2f7;
	--itpngc-border: #dfe5ee;
	--itpngc-border-strong: #c4cede;
	--itpngc-text: #14213a;
	--itpngc-text-soft: #5c6c86;
	--itpngc-accent: #2563eb;
	--itpngc-accent-dark: #1d4ed8;
	--itpngc-accent-soft: rgba( 37, 99, 235, 0.08 );
	--itpngc-success: #0f9d58;
	--itpngc-success-soft: rgba( 15, 157, 88, 0.1 );
	--itpngc-error: #d93025;
	--itpngc-error-soft: rgba( 217, 48, 37, 0.09 );
	--itpngc-radius: 14px;
	--itpngc-radius-sm: 9px;
	--itpngc-shadow: 0 1px 2px rgba( 20, 33, 58, 0.05 ), 0 8px 24px rgba( 20, 33, 58, 0.06 );

	box-sizing: border-box;
	max-width: 860px;
	margin: 0 auto;
	padding: 0;
	color: var( --itpngc-text );
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: 16px;
	line-height: 1.6;
	text-align: left;
	direction: ltr;
}

.itpngc-wrap *,
.itpngc-wrap *::before,
.itpngc-wrap *::after {
	box-sizing: border-box;
}

/* Elements the script shows and hides through the `hidden` property. The
   explicit rule is required because component rules further down set an
   explicit display on those same elements, which would otherwise win. */
.itpngc-wrap [hidden] {
	display: none !important;
}

/* ---------------------------------------------------------------- heading */

.itpngc-title {
	margin: 0 0 8px;
	color: var( --itpngc-text );
	font-size: 1.6em;
	font-weight: 700;
	line-height: 1.35;
}

.itpngc-description {
	margin: 0 0 22px;
	color: var( --itpngc-text-soft );
	font-size: 0.98em;
}

/* --------------------------------------------------------------- dropzone */

.itpngc-dropzone {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 40px 22px;
	border: 2px dashed var( --itpngc-border-strong );
	border-radius: var( --itpngc-radius );
	background-color: var( --itpngc-bg-soft );
	color: var( --itpngc-text );
	text-align: center;
	cursor: pointer;
	transition: border-color 0.18s ease, background-color 0.18s ease, transform 0.18s ease;
}

.itpngc-dropzone:hover {
	border-color: var( --itpngc-accent );
	background-color: var( --itpngc-accent-soft );
}

.itpngc-dropzone:focus-visible {
	outline: 3px solid var( --itpngc-accent );
	outline-offset: 3px;
}

/* Fallback for browsers without :focus-visible. */
.itpngc-dropzone:focus {
	outline: 3px solid var( --itpngc-accent );
	outline-offset: 3px;
}

.itpngc-dropzone:focus:not( :focus-visible ) {
	outline: none;
}

.itpngc-dropzone.is-dragover {
	border-color: var( --itpngc-accent );
	border-style: solid;
	background-color: var( --itpngc-accent-soft );
	transform: scale( 1.01 );
}

.itpngc-dropzone.is-disabled {
	border-color: var( --itpngc-border );
	background-color: var( --itpngc-bg-sunken );
	opacity: 0.6;
	cursor: not-allowed;
}

.itpngc-dropzone-icon {
	margin-bottom: 4px;
	color: var( --itpngc-accent );
}

.itpngc-dropzone-title {
	font-size: 1.12em;
	font-weight: 700;
}

.itpngc-dropzone-sub {
	color: var( --itpngc-text-soft );
	font-size: 0.95em;
}

.itpngc-dropzone-hint {
	margin-top: 8px;
	color: var( --itpngc-text-soft );
	font-size: 0.82em;
	line-height: 1.7;
}

/* The real input stays in the DOM (and focusable) but out of sight. */
.itpngc-input,
.itpngc-visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	border: 0;
	clip: rect( 0 0 0 0 );
	clip-path: inset( 50% );
	white-space: nowrap;
}

/* --------------------------------------------------------------- messages */

.itpngc-messages:empty {
	display: none;
}

.itpngc-msg {
	margin: 16px 0 0;
	padding: 12px 15px;
	border: 1px solid transparent;
	border-radius: var( --itpngc-radius-sm );
	font-size: 0.94em;
}

.itpngc-msg-error {
	border-color: rgba( 217, 48, 37, 0.35 );
	background-color: var( --itpngc-error-soft );
	color: var( --itpngc-error );
}

.itpngc-msg-success {
	border-color: rgba( 15, 157, 88, 0.32 );
	background-color: var( --itpngc-success-soft );
	color: var( --itpngc-success );
}

.itpngc-msg-info {
	border-color: var( --itpngc-border );
	background-color: var( --itpngc-bg-soft );
	color: var( --itpngc-text-soft );
}

/* ---------------------------------------------------------------- toolbar */

.itpngc-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-top: 22px;
	padding-bottom: 12px;
	border-bottom: 1px solid var( --itpngc-border );
}

.itpngc-toolbar[hidden] {
	display: none;
}

.itpngc-counter {
	color: var( --itpngc-text-soft );
	font-size: 0.92em;
	font-weight: 600;
}

/* ---------------------------------------------------------------- buttons */

.itpngc-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 42px;
	padding: 9px 18px;
	border: 1px solid transparent;
	border-radius: var( --itpngc-radius-sm );
	background-color: var( --itpngc-accent );
	color: #ffffff;
	font-family: inherit;
	font-size: 0.95em;
	font-weight: 700;
	line-height: 1.2;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, opacity 0.16s ease;
}

.itpngc-btn:hover,
.itpngc-btn:focus {
	background-color: var( --itpngc-accent-dark );
	color: #ffffff;
	text-decoration: none;
}

.itpngc-btn:focus-visible {
	outline: 3px solid var( --itpngc-accent );
	outline-offset: 2px;
}

.itpngc-btn[disabled],
.itpngc-btn.is-disabled {
	opacity: 0.5;
	cursor: not-allowed;
	pointer-events: none;
}

.itpngc-btn-ghost {
	border-color: var( --itpngc-border-strong );
	background-color: transparent;
	color: var( --itpngc-text-soft );
}

.itpngc-btn-ghost:hover,
.itpngc-btn-ghost:focus {
	border-color: var( --itpngc-error );
	background-color: var( --itpngc-error-soft );
	color: var( --itpngc-error );
}

.itpngc-btn-icon {
	flex: 0 0 auto;
	width: 18px;
	height: 18px;
}

/* ------------------------------------------------------------ crop editor */

.itpngc-editor {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.itpngc-editor-title {
	color: var( --itpngc-text-soft );
	font-size: 0.82em;
	font-weight: 700;
}

.itpngc-stage-host {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 140px;
	padding: 10px;
	border: 1px solid var( --itpngc-border );
	border-radius: var( --itpngc-radius-sm );
	background-color: var( --itpngc-bg-soft );
}

/*
 * The stage is exactly as large as the displayed image, which lets the crop
 * box be positioned in percentages. That is what makes the selection survive
 * any responsive resize without a single recalculation in JavaScript.
 */
.itpngc-stage {
	position: relative;
	display: inline-block;
	max-width: 100%;
	line-height: 0;

	/* Checkerboard, so transparency in the source is visible while cropping. */
	background-color: #ffffff;
	background-image:
		linear-gradient( 45deg, #e9edf3 25%, transparent 25%, transparent 75%, #e9edf3 75% ),
		linear-gradient( 45deg, #e9edf3 25%, transparent 25%, transparent 75%, #e9edf3 75% );
	background-position: 0 0, 8px 8px;
	background-size: 16px 16px;
}

.itpngc-editor-image {
	display: block;
	max-width: 100%;
	max-height: 58vh;
	height: auto;
	user-select: none;
	-webkit-user-select: none;
	-webkit-user-drag: none;
	-webkit-touch-callout: none;
}

.itpngc-editor-image.is-pixelated {
	image-rendering: pixelated;
}

/* Clips the crop box's oversized dimming shadow to the image area. */
.itpngc-overlay {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	overflow: hidden;
}

/* The 100vmax shadow is what dims everything outside the selection. */
.itpngc-cropbox {
	position: absolute;
	border: 1px solid #ffffff;
	box-shadow:
		0 0 0 1px rgba( 0, 0, 0, 0.55 ),
		0 0 0 100vmax rgba( 0, 0, 0, 0.45 );
	cursor: move;
	touch-action: none;
}

.itpngc-cropbox:focus {
	outline: 2px solid var( --itpngc-accent );
	outline-offset: 2px;
}

.itpngc-cropbox.is-dragging {
	cursor: grabbing;
}

.itpngc-handle {
	position: absolute;
	width: 14px;
	height: 14px;
	margin: -7px;
	border: 1px solid rgba( 0, 0, 0, 0.55 );
	border-radius: 2px;
	background-color: #ffffff;
	touch-action: none;
}

.itpngc-handle-nw {
	top: 0;
	left: 0;
	cursor: nwse-resize;
}

.itpngc-handle-n {
	top: 0;
	left: 50%;
	cursor: ns-resize;
}

.itpngc-handle-ne {
	top: 0;
	left: 100%;
	cursor: nesw-resize;
}

.itpngc-handle-e {
	top: 50%;
	left: 100%;
	cursor: ew-resize;
}

.itpngc-handle-se {
	top: 100%;
	left: 100%;
	cursor: nwse-resize;
}

.itpngc-handle-s {
	top: 100%;
	left: 50%;
	cursor: ns-resize;
}

.itpngc-handle-sw {
	top: 100%;
	left: 0;
	cursor: nesw-resize;
}

.itpngc-handle-w {
	top: 50%;
	left: 0;
	cursor: ew-resize;
}

/* Live selection size, pinned inside the top-left corner of the crop box. */
.itpngc-cropsize {
	position: absolute;
	top: 6px;
	left: 6px;
	padding: 2px 8px;
	border-radius: 999px;
	background-color: rgba( 17, 24, 39, 0.78 );
	color: #ffffff;
	font-size: 11px;
	font-weight: 700;
	line-height: 1.7;
	white-space: nowrap;
	pointer-events: none;
}

.itpngc-editor-hint {
	margin: 0;
	color: var( --itpngc-text-soft );
	font-size: 0.82em;
	line-height: 1.7;
}

.itpngc-editor-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
}

.itpngc-selection-info {
	flex: 1 1 auto;
	color: var( --itpngc-text );
	font-size: 0.86em;
	font-weight: 700;
}

/* Touch screens get larger grab targets. */
@media ( pointer: coarse ) {
	.itpngc-handle {
		width: 22px;
		height: 22px;
		margin: -11px;
	}

	.itpngc-cropsize {
		font-size: 12px;
	}
}

@media ( max-width: 600px ) {
	.itpngc-stage-host {
		padding: 6px;
	}

	.itpngc-editor-image {
		max-height: 46vh;
	}

	.itpngc-selection-info,
	.itpngc-editor-actions .itpngc-btn {
		flex: 1 1 100%;
	}

	/* Declared before the base .itpngc-mode rule, so it needs the extra
	   specificity of the parent selector to win at narrow widths. */
	.itpngc-modes .itpngc-mode {
		flex: 1 1 44%;
		padding: 7px 6px;
		font-size: 0.76em;
		white-space: normal;
	}
}

@media ( prefers-color-scheme: dark ) {
	.itpngc-stage {
		background-color: #10131a;
		background-image:
			linear-gradient( 45deg, #232935 25%, transparent 25%, transparent 75%, #232935 75% ),
			linear-gradient( 45deg, #232935 25%, transparent 25%, transparent 75%, #232935 75% );
	}

	.itpngc-handle {
		border-color: rgba( 0, 0, 0, 0.7 );
		background-color: #f4f7ff;
	}

	.itpngc-modes .itpngc-mode.is-active {
		background-color: var( --itpngc-bg-soft );
		box-shadow: 0 1px 2px rgba( 0, 0, 0, 0.4 );
	}
}

/* ------------------------------------------------------- selection modes */

.itpngc-modes {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	padding: 4px;
	border: 1px solid var( --itpngc-border );
	border-radius: var( --itpngc-radius-sm );
	background-color: var( --itpngc-bg-sunken );
}

.itpngc-mode {
	flex: 1 1 auto;
	min-width: 0;
	min-height: 36px;
	padding: 7px 14px;
	border: 1px solid transparent;
	border-radius: 6px;
	background-color: transparent;
	color: var( --itpngc-text-soft );
	font-family: inherit;
	font-size: 0.86em;
	font-weight: 700;
	line-height: 1.2;
	white-space: nowrap;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.itpngc-mode:hover {
	color: var( --itpngc-text );
}

.itpngc-mode:focus-visible {
	outline: 3px solid var( --itpngc-accent );
	outline-offset: -1px;
}

.itpngc-mode.is-active {
	background-color: var( --itpngc-bg );
	color: var( --itpngc-accent );
	box-shadow: 0 1px 2px rgba( 20, 33, 58, 0.12 );
}

/* ------------------------------------------------------------ lasso tool */

/*
 * The outline canvas sits exactly on top of the image. Points are stored in
 * source-image pixels and the canvas is re-sized and redrawn whenever the
 * displayed image changes size, so the outline never drifts.
 */
.itpngc-lasso {
	position: absolute;
	top: 0;
	left: 0;
	display: block;
	cursor: crosshair;
	touch-action: none;
}

.itpngc-lasso.is-drawing {
	cursor: crosshair;
}

/* ----------------------------------------------------- AI click select */

/*
 * Sits exactly over the image and captures taps. The mask is painted at a
 * capped resolution and scaled up by the browser, so a large photo does not
 * cost a full-resolution RGBA buffer just to show a highlight.
 */
.itpngc-clickmask {
	position: absolute;
	top: 0;
	left: 0;
	display: block;
	cursor: progress;
	touch-action: manipulation;
}

.itpngc-clickmask.is-ready {
	cursor: crosshair;
}

.itpngc-clickmask:focus-visible {
	outline: 3px solid var( --itpngc-accent );
	outline-offset: 2px;
}

/* While the encoder runs, the stage reads as busy rather than broken. */
.itpngc-card[data-mode="click"].is-working .itpngc-stage {
	opacity: 0.85;
}

/* --------------------------------------------------------- smart AI mode */

.itpngc-smart-preview {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.itpngc-ai-note {
	margin: 0;
	padding: 10px 13px;
	border: 1px solid var( --itpngc-border );
	border-radius: var( --itpngc-radius-sm );
	background-color: var( --itpngc-bg-soft );
	color: var( --itpngc-text-soft );
	font-size: 0.8em;
	line-height: 1.7;
}

.itpngc-ai-note[hidden] {
	display: none;
}

.itpngc-btn-ai {
	background-color: var( --itpngc-accent );
}

/* A card mid-inference gets a subtle busy treatment on the stage. */
.itpngc-card.is-working .itpngc-stage-host {
	opacity: 0.75;
}

.itpngc-card.is-working .itpngc-selection-info {
	color: var( --itpngc-accent );
}

/* ------------------------------------------------------------- progress */

.itpngc-progress {
	display: flex;
	flex-direction: column;
	gap: 7px;
}

.itpngc-progress-track {
	position: relative;
	height: 10px;
	overflow: hidden;
	border-radius: 999px;
	background-color: var( --itpngc-bg-sunken );
}

.itpngc-progress-fill {
	display: block;
	height: 100%;
	width: 0;
	border-radius: 999px;
	background-image: linear-gradient( 90deg, var( --itpngc-accent ), var( --itpngc-accent-dark ), var( --itpngc-accent ) );
	background-size: 200% 100%;
	transition: width 0.18s ease;
	animation: itpngc-shimmer 1.4s linear infinite;
}

/* No percentage available at all: a bar segment sweeps back and forth. */
.itpngc-progress.is-indeterminate .itpngc-progress-fill {
	width: 40%;
	transition: none;
	animation: itpngc-sweep 1.1s ease-in-out infinite;
}

.itpngc-progress-text {
	color: var( --itpngc-accent );
	font-size: 0.86em;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	animation: itpngc-pulse 1.4s ease-in-out infinite;
}

@keyframes itpngc-shimmer {
	from { background-position: 0 0; }
	to { background-position: 200% 0; }
}

@keyframes itpngc-sweep {
	0% { transform: translateX( -120% ); }
	100% { transform: translateX( 280% ); }
}

@keyframes itpngc-pulse {
	0%, 100% { opacity: 1; }
	50% { opacity: 0.45; }
}

/* Small header badge for work happening in the background. */
.itpngc-ai-badge {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 3px 10px;
	border-radius: 999px;
	background-color: var( --itpngc-bg-sunken );
	color: var( --itpngc-text-soft );
	font-size: 0.76em;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.itpngc-ai-badge.is-busy {
	color: var( --itpngc-accent );
	animation: itpngc-pulse 1.4s ease-in-out infinite;
}

.itpngc-ai-badge.is-ready {
	background-color: var( --itpngc-success-soft );
	color: var( --itpngc-success );
}

.itpngc-ai-badge.is-ready::before {
	content: "\2713";
}

/* "Back to editing" is navigation, not destruction: accent hover, not red. */
.itpngc-back:hover,
.itpngc-back:focus {
	border-color: var( --itpngc-accent );
	background-color: var( --itpngc-accent-soft );
	color: var( --itpngc-accent );
}

/* Two-step "Clear all": armed state reads as a warning. */
.itpngc-clear.is-armed {
	border-color: var( --itpngc-error );
	background-color: var( --itpngc-error-soft );
	color: var( --itpngc-error );
}

@media ( prefers-reduced-motion: reduce ) {
	.itpngc-progress-fill,
	.itpngc-progress-text,
	.itpngc-ai-badge.is-busy {
		animation: none;
	}
}

/* ----------------------------------------------------------------- cards */

.itpngc-results {
	display: flex;
	flex-direction: column;
	gap: 18px;
	margin-top: 18px;
}

.itpngc-results:empty {
	margin-top: 0;
}

.itpngc-card {
	padding: 16px;
	border: 1px solid var( --itpngc-border );
	border-radius: var( --itpngc-radius );
	background-color: var( --itpngc-bg );
	box-shadow: var( --itpngc-shadow );
	animation: itpngc-fade-in 0.25s ease both;
}

@keyframes itpngc-fade-in {
	from {
		opacity: 0;
		transform: translateY( 6px );
	}

	to {
		opacity: 1;
		transform: none;
	}
}

.itpngc-card.is-error {
	border-color: rgba( 217, 48, 37, 0.4 );
}

.itpngc-card-head {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 6px 14px;
	margin-bottom: 14px;
}

.itpngc-card-name {
	flex: 1 1 220px;
	min-width: 0;
	overflow: hidden;
	font-size: 0.98em;
	font-weight: 700;
	text-overflow: ellipsis;
	white-space: nowrap;
	direction: ltr;
	text-align: left;
	unicode-bidi: plaintext;
}

.itpngc-card-status {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 3px 11px;
	border-radius: 999px;
	background-color: var( --itpngc-bg-sunken );
	color: var( --itpngc-text-soft );
	font-size: 0.8em;
	font-weight: 700;
	white-space: nowrap;
}

.itpngc-card.is-done .itpngc-card-status {
	background-color: var( --itpngc-success-soft );
	color: var( --itpngc-success );
}

.itpngc-card.is-error .itpngc-card-status {
	background-color: var( --itpngc-error-soft );
	color: var( --itpngc-error );
}

.itpngc-spinner {
	display: none;
	flex: 0 0 auto;
	width: 12px;
	height: 12px;
	border: 2px solid currentColor;
	border-top-color: transparent;
	border-radius: 50%;
	animation: itpngc-spin 0.7s linear infinite;
}

.itpngc-card.is-working .itpngc-spinner {
	display: inline-block;
}

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

@media ( prefers-reduced-motion: reduce ) {
	.itpngc-card,
	.itpngc-spinner,
	.itpngc-dropzone {
		animation: none;
		transition: none;
	}
}

/* --------------------------------------------------------------- previews */

.itpngc-panes {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 14px;
	align-items: stretch;
}

.itpngc-pane {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 12px;
	border: 1px solid var( --itpngc-border );
	border-radius: var( --itpngc-radius-sm );
	background-color: var( --itpngc-bg-soft );
	min-width: 0;
}

.itpngc-pane-label {
	color: var( --itpngc-text-soft );
	font-size: 0.82em;
	font-weight: 700;
}

.itpngc-thumb {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 130px;
	padding: 8px;
	border-radius: var( --itpngc-radius-sm );

	/* Checkerboard, so PNG transparency is obvious in the preview. */
	background-color: #ffffff;
	background-image:
		linear-gradient( 45deg, #e9edf3 25%, transparent 25%, transparent 75%, #e9edf3 75% ),
		linear-gradient( 45deg, #e9edf3 25%, transparent 25%, transparent 75%, #e9edf3 75% );
	background-position: 0 0, 8px 8px;
	background-size: 16px 16px;
}

.itpngc-thumb img {
	display: block;
	max-width: 100%;
	max-height: 190px;
	width: auto;
	height: auto;
	border-radius: 4px;
	object-fit: contain;
}

.itpngc-thumb-placeholder {
	color: var( --itpngc-text-soft );
	font-size: 0.85em;
	text-align: center;
}

.itpngc-meta {
	margin: 0;
	color: var( --itpngc-text-soft );
	font-size: 0.82em;
	line-height: 1.8;
	word-break: break-word;
}

.itpngc-meta strong {
	color: var( --itpngc-text );
	font-weight: 700;
}

/* ------------------------------------------------------------ card footer */

.itpngc-card-foot {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
	margin-top: 14px;
}

.itpngc-card-error {
	margin: 14px 0 0;
	padding: 11px 14px;
	border: 1px solid rgba( 217, 48, 37, 0.35 );
	border-radius: var( --itpngc-radius-sm );
	background-color: var( --itpngc-error-soft );
	color: var( --itpngc-error );
	font-size: 0.9em;
}

.itpngc-card-error[hidden] {
	display: none;
}

/* -------------------------------------------------------------- responsive */

@media ( max-width: 600px ) {
	.itpngc-wrap {
		font-size: 15px;
	}

	.itpngc-dropzone {
		padding: 30px 16px;
	}

	.itpngc-panes {
		grid-template-columns: 1fr;
	}

	.itpngc-card-foot .itpngc-btn {
		flex: 1 1 100%;
	}

	.itpngc-toolbar {
		justify-content: center;
	}
}

/* --------------------------------------------------------------- dark mode */

@media ( prefers-color-scheme: dark ) {
	.itpngc-wrap {
		--itpngc-bg: #171b24;
		--itpngc-bg-soft: #1e2430;
		--itpngc-bg-sunken: #262d3b;
		--itpngc-border: #2f3746;
		--itpngc-border-strong: #414c60;
		--itpngc-text: #eaeef6;
		--itpngc-text-soft: #9aa7bd;
		--itpngc-accent: #5b8cff;
		--itpngc-accent-dark: #7ba3ff;
		--itpngc-accent-soft: rgba( 91, 140, 255, 0.14 );
		--itpngc-success: #4ade80;
		--itpngc-success-soft: rgba( 74, 222, 128, 0.14 );
		--itpngc-error: #ff7b72;
		--itpngc-error-soft: rgba( 255, 123, 114, 0.14 );
		--itpngc-shadow: 0 1px 2px rgba( 0, 0, 0, 0.3 ), 0 8px 24px rgba( 0, 0, 0, 0.28 );
	}

	/* Solid buttons get dark text on the light accent; ghost variants (Reset,
	   Remove, Back, the armed Clear all) keep their own token colours. */
	.itpngc-btn:not( .itpngc-btn-ghost ) {
		color: #0d1017;
	}

	.itpngc-btn:not( .itpngc-btn-ghost ):hover,
	.itpngc-btn:not( .itpngc-btn-ghost ):focus {
		color: #0d1017;
	}

	.itpngc-thumb {
		background-color: #10131a;
		background-image:
			linear-gradient( 45deg, #232935 25%, transparent 25%, transparent 75%, #232935 75% ),
			linear-gradient( 45deg, #232935 25%, transparent 25%, transparent 75%, #232935 75% );
	}
}
