.usw-widget {
	--usw-pos-top: auto;
	--usw-pos-right: auto;
	--usw-pos-bottom: auto;
	--usw-pos-left: auto;
	--usw-pos-transform: none;

	position: fixed;
	top: var(--usw-pos-top);
	right: var(--usw-pos-right);
	bottom: var(--usw-pos-bottom);
	left: var(--usw-pos-left);
	transform: var(--usw-pos-transform);
	z-index: 2147483600;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
	font-size: 14px;
	line-height: 1.4;
	color: #1f2937;
	direction: ltr;
	text-align: left;
}

.usw-widget *,
.usw-widget *::before,
.usw-widget *::after {
	box-sizing: border-box;
}

/* === Default position: bottom-right === */
.usw-widget:not([data-usw-pos]) {
	top: auto;
	right: 20px;
	bottom: 20px;
	left: auto;
}

.usw-trigger {
	width: 56px;
	height: 56px;
	border-radius: 50%;
	border: none;
	background-color: #0048ff;
	background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'><path d='M12 2a2 2 0 1 0 0 4 2 2 0 0 0 0-4Zm-7 7a2 2 0 1 0 0 4 2 2 0 0 0 0-4Zm14 0a2 2 0 1 0 0 4 2 2 0 0 0 0-4ZM12 9c-3.31 0-6 2.69-6 6v5h2v-5c0-2.21 1.79-4 4-4s4 1.79 4 4v5h2v-5c0-3.31-2.69-6-6-6Z'/></svg>");
	background-position: center center;
	background-repeat: no-repeat;
	background-size: 28px 28px;
	cursor: pointer;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25), 0 0 0 4px rgba(0, 72, 255, 0.12);
	transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
	padding: 0;
	display: block;
	position: relative;
	z-index: 2147483601;
}

.usw-trigger:hover,
.usw-trigger:focus-visible {
	transform: translateY(-2px) scale(1.04);
	box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3), 0 0 0 6px rgba(0, 72, 255, 0.18);
	outline: none;
}

.usw-trigger.usw-open {
	background-color: #0033cc;
	box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3), 0 0 0 6px rgba(0, 72, 255, 0.22);
	transform: scale(0.96);
}

.usw-panel {
	position: fixed;
	top: 0;
	bottom: auto;
	left: auto;
	right: auto;
	width: min(360px, 90vw);
	height: 100vh;
	max-height: 100vh;
	overflow-y: auto;
	background: #ffffff;
	border-radius: 0;
	box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
	padding: 20px 18px 18px;
	display: block;
	transform: translateY(-100%);
	visibility: hidden;
	opacity: 0;
	transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease, visibility 0s linear 0.32s;
	z-index: 2147483600;
	border-left: 1px solid rgba(15, 23, 42, 0.06);
}

.usw-widget[data-usw-panel-side="right"] .usw-panel {
	right: 0;
	left: auto;
	border-left: 1px solid rgba(15, 23, 42, 0.06);
	border-right: none;
}

.usw-widget[data-usw-panel-side="left"] .usw-panel {
	left: 0;
	right: auto;
	border-right: 1px solid rgba(15, 23, 42, 0.06);
	border-left: none;
}

.usw-panel.usw-open {
	transform: translateY(0);
	visibility: visible;
	opacity: 1;
	transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease, visibility 0s linear 0s;
}

.usw-panel[hidden] {
	display: none !important;
}

@keyframes usw-fade-in {
	from { opacity: 0; }
	to   { opacity: 1; }
}

.usw-panel-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 12px;
	padding-bottom: 10px;
	border-bottom: 1px solid #f3f4f6;
}

.usw-title {
	margin: 0;
	font-size: 14px;
	font-weight: 700;
	color: #111827;
	letter-spacing: -0.01em;
	display: flex;
	align-items: center;
	gap: 6px;
}

.usw-title-meta {
	font-weight: 500;
	color: #9ca3af;
	font-size: 11px;
	margin-left: 6px;
	letter-spacing: 0;
}

.usw-close {
	width: 26px;
	height: 26px;
	border: none;
	background: transparent;
	color: #9ca3af;
	cursor: pointer;
	font-size: 18px;
	line-height: 1;
	padding: 0;
	border-radius: 6px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.usw-close:hover,
.usw-close:focus-visible {
	background: #f3f4f6;
	color: #111827;
	outline: none;
}

.usw-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 8px;
	margin: 0 0 10px;
	padding: 0;
	list-style: none;
}

.usw-action {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 14px 8px;
	min-height: 92px;
	background: #f9fafb;
	border: 1px solid #e5e7eb;
	border-radius: 12px;
	color: #111827;
	font-size: 12px;
	font-weight: 600;
	line-height: 1.2;
	cursor: pointer;
	text-align: center;
	transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
	width: 100%;
	font-family: inherit;
}

.usw-action:hover,
.usw-action:focus-visible {
	background: #f3f4f6;
	border-color: #c7d2fe;
	outline: none;
}

.usw-action[aria-pressed="true"] {
	background: #0048ff;
	border-color: #0048ff;
	color: #ffffff;
	box-shadow: 0 4px 12px rgba(0, 72, 255, 0.25);
}

.usw-action .usw-action-icon {
	width: 28px;
	height: 28px;
	flex-shrink: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: #4b5563;
}

.usw-action[aria-pressed="true"] .usw-action-icon {
	color: #ffffff;
}

.usw-reset {
	grid-column: 1 / -1;
	background: transparent;
	border: 1px dashed #e5e7eb;
	color: #6b7280;
	margin: 6px 0 0;
	font-weight: 500;
	font-size: 11px;
	min-height: 0;
	padding: 6px 10px;
	flex-direction: row;
	gap: 6px;
	justify-content: center;
	box-shadow: none;
}

.usw-reset[aria-pressed="true"] {
	background: transparent;
	border-color: #e5e7eb;
	color: #6b7280;
	box-shadow: none;
}

.usw-footer-note {
	margin-top: 8px;
	color: #9ca3af;
	font-size: 10px;
	text-align: center;
}

.usw-reset:hover,
.usw-reset:focus-visible {
	background: #f9fafb;
	border-color: #d1d5db;
	color: #111827;
}

.usw-footer {
	margin-top: 4px;
	padding-top: 0;
	font-size: 11px;
	color: #9ca3af;
	text-align: center;
}

/* === Drawer: side panel that drops from the top edge === */

/* The drawer is `position: fixed; top: 0; height: 100vh` (declared above) and slides
   in from the top via `transform: translateY(-100%) → 0`. Its left/right edge is
   driven by the user's `panel_direction` setting (`data-usw-panel-side`). */

/* Backdrop covers the rest of the screen while the drawer is open. */
.usw-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(15, 23, 42, 0.45);
	backdrop-filter: blur(2px);
	-webkit-backdrop-filter: blur(2px);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.24s ease, visibility 0s linear 0.24s;
	z-index: 2147483599;
}

.usw-backdrop.usw-open {
	opacity: 1;
	visibility: visible;
	transition: opacity 0.24s ease, visibility 0s linear 0s;
}

/* Lock background page scroll while the drawer is open. */
html.usw-drawer-open,
html.usw-drawer-open body {
	overflow: hidden;
}

/* === Accessibility body classes === */

html.usw-font-large body {
	font-size: 118%;
}

html.usw-font-larger body {
	font-size: 135%;
}

html.usw-font-small body {
	font-size: 90%;
}

html.usw-readable-font body,
html.usw-readable-font *:not(.usw-widget):not(.usw-widget *) {
	font-family: "Comic Sans MS", "Trebuchet MS", Verdana, sans-serif !important;
	letter-spacing: 0.02em;
}

html.usw-grayscale body {
	filter: grayscale(100%);
}

html.usw-contrast-dark body {
	background: #000000 !important;
	color: #ffff00 !important;
}

html.usw-contrast-dark body *:not(.usw-widget):not(.usw-widget *) {
	background-color: #000000 !important;
	color: #ffff00 !important;
	border-color: #ffff00 !important;
}

html.usw-contrast-light body {
	background: #ffffff !important;
	color: #000000 !important;
}

html.usw-contrast-light body *:not(.usw-widget):not(.usw-widget *) {
	background-color: #ffffff !important;
	color: #000000 !important;
	border-color: #000000 !important;
}

html.usw-highlight-links a:not(.usw-widget *) {
	background: #ffff00 !important;
	color: #000000 !important;
	text-decoration: underline !important;
	font-weight: 700 !important;
}

html.usw-cursor-large,
html.usw-cursor-large *:not(.usw-widget):not(.usw-widget *) {
	cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'><path d='M4 2 L4 28 L11 21 L15 30 L19 28 L15 19 L24 19 Z' fill='black' stroke='white' stroke-width='1.5'/></svg>") 4 2, auto !important;
}

html.usw-stop-animations *,
html.usw-stop-animations *::before,
html.usw-stop-animations *::after {
	animation: none !important;
	transition: none !important;
	scroll-behavior: auto !important;
}

html.usw-text-spacing body,
html.usw-text-spacing body *:not(.usw-widget):not(.usw-widget *) {
	letter-spacing: 0.12em !important;
	word-spacing: 0.20em !important;
}

html.usw-hide-images img,
html.usw-hide-images picture,
html.usw-hide-images svg,
html.usw-hide-images video,
html.usw-hide-images [style*="background-image"]:not(.usw-widget):not(.usw-widget *) {
	visibility: hidden !important;
}

html.usw-line-height body,
html.usw-line-height body *:not(.usw-widget):not(.usw-widget *) {
	line-height: 2 !important;
}

html.usw-text-align body,
html.usw-text-align body *:not(.usw-widget):not(.usw-widget *):not(input):not(textarea):not(button) {
	text-align: left !important;
}

html.usw-saturate body {
	filter: saturate(180%);
}

/* === Info popover === */

.usw-info-popover {
	position: absolute;
	left: 16px;
	right: 16px;
	top: 64px;
	bottom: 14px;
	background: #ffffff;
	border-radius: 12px;
	border: 1px solid rgba(15, 23, 42, 0.08);
	box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18), 0 4px 12px rgba(15, 23, 42, 0.08);
	padding: 18px 18px;
	display: none;
	z-index: 10;
	overflow-y: auto;
}

.usw-info-popover.usw-open {
	display: block;
	animation: usw-fade-in 0.18s ease-out;
}

.usw-info-popover h3 {
	margin: 0 0 8px;
	font-size: 14px;
	font-weight: 700;
	color: #111827;
	display: flex;
	align-items: center;
	gap: 6px;
}

.usw-info-popover p {
	margin: 0 0 10px;
	font-size: 12px;
	line-height: 1.5;
	color: #4b5563;
}

.usw-info-popover ul {
	margin: 0;
	padding-left: 18px;
	font-size: 12px;
	line-height: 1.6;
	color: #4b5563;
}

.usw-info-popover-close {
	position: absolute;
	top: 8px;
	right: 8px;
	width: 24px;
	height: 24px;
	border: none;
	background: transparent;
	color: #6b7280;
	cursor: pointer;
	font-size: 18px;
	line-height: 1;
	padding: 0;
	border-radius: 6px;
}

.usw-info-popover-close:hover,
.usw-info-popover-close:focus-visible {
	background: #f3f4f6;
	color: #111827;
	outline: none;
}

/* Contrast-cycle button: small inline state pill */

.usw-action .usw-action-state {
	display: inline-block;
	margin-left: 4px;
	font-size: 10px;
	font-weight: 700;
	padding: 2px 6px;
	border-radius: 999px;
	background: rgba(0, 72, 255, 0.12);
	color: #0048ff;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	min-height: 16px;
}

.usw-action .usw-action-state:empty {
	display: none;
}

.usw-action[aria-pressed="true"] .usw-action-state {
	background: rgba(255, 255, 255, 0.25);
	color: #ffffff;
}

@media (max-width: 480px) {
	.usw-panel {
		width: calc(100vw - 32px);
	}
}

@media (prefers-reduced-motion: reduce) {
	.usw-trigger,
	.usw-panel,
	.usw-action {
		transition: none;
		animation: none;
	}
}
