html,
body {
	margin: 0 !important;
	padding: 0 !important;
	width: 100%;
	height: 100%;
}

.spv-body {
	background: #111827;
	overflow: hidden;
}

.spv-no-select,
.spv-no-select * {
	user-select: none !important;
	-webkit-user-select: none !important;
}

#spv-app {
	width: 100vw;
	height: 100vh;
	display: flex;
	flex-direction: column;
	position: relative;
	overflow: hidden;
}

.spv-toolbar {
	height: 60px;
	min-height: 60px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0 20px;
	background: #111827;
	color: #ffffff;
	box-sizing: border-box;
	user-select: none;
	gap: 12px;
}

.spv-title {
	max-width: 45%;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-size: 16px;
	font-weight: 600;
}

.spv-controls {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
	justify-content: flex-end;
}

.spv-controls button,
.spv-footer button,
.spv-reload {
	border: 0;
	background: #374151;
	color: #ffffff;
	padding: 8px 14px;
	border-radius: 6px;
	cursor: pointer;
	font-size: 14px;
	min-height: 40px;
	min-width: 40px;
}

.spv-controls button:hover,
.spv-footer button:hover {
	background: #4b5563;
}

.spv-controls button:focus-visible,
.spv-footer button:focus-visible,
.spv-mode-toggle button:focus-visible {
	outline: 2px solid #93c5fd;
	outline-offset: 2px;
}

.spv-footer button:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

.spv-mode-toggle {
	display: inline-flex;
	border: 1px solid #4b5563;
	border-radius: 6px;
	overflow: hidden;
	margin-right: 4px;
}

.spv-mode-toggle button {
	border-radius: 0;
	background: transparent;
}

.spv-mode-toggle button[aria-pressed="true"] {
	background: #2563eb;
}

#spv-zoom-value {
	min-width: 50px;
	text-align: center;
}

.spv-workspace {
	flex: 1;
	min-height: 0;
	display: flex;
	position: relative;
	overflow: hidden;
}

.spv-viewer {
	flex: 1;
	min-width: 0;
	overflow: auto;
	overflow-anchor: none;
	background: #e5e7eb;
	padding: 30px;
	box-sizing: border-box;
	display: flex;
	justify-content: center;
	align-items: flex-start;
	position: relative;
}

.spv-thumbs {
	flex: 0 0 168px;
	width: 168px;
	max-width: 40vw;
	display: flex;
	flex-direction: column;
	background: #1f2937;
	color: #ffffff;
	border-right: 1px solid #374151;
	box-sizing: border-box;
	z-index: 30;
}

.spv-thumbs[hidden] {
	display: none !important;
}

.spv-thumbs-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 10px 12px;
	border-bottom: 1px solid #374151;
	flex-shrink: 0;
}

.spv-thumbs-title {
	font-size: 13px;
	font-weight: 600;
	color: #e5e7eb;
}

.spv-thumbs-close {
	border: 0;
	background: #374151;
	color: #ffffff;
	padding: 6px 10px;
	border-radius: 6px;
	cursor: pointer;
	font-size: 12px;
	min-height: 32px;
}

.spv-thumbs-close:hover {
	background: #4b5563;
}

.spv-thumbs-list {
	flex: 1;
	overflow: auto;
	overflow-x: hidden;
	padding: 10px 8px 16px;
	box-sizing: border-box;
}

.spv-thumb {
	display: block;
	width: 100%;
	margin: 0 0 12px;
	padding: 8px;
	border: 2px solid transparent;
	border-radius: 8px;
	background: #111827;
	color: #e5e7eb;
	cursor: pointer;
	text-align: left;
	box-sizing: border-box;
}

.spv-thumb:hover {
	border-color: #4b5563;
}

.spv-thumb.is-active {
	border-color: #60a5fa;
	background: #1e3a5f;
}

.spv-thumb:focus-visible {
	outline: 2px solid #93c5fd;
	outline-offset: 2px;
}

.spv-thumb-label {
	display: block;
	font-size: 12px;
	margin-bottom: 6px;
	color: #d1d5db;
}

.spv-thumb-frame {
	display: block;
	width: 100%;
	min-height: 120px;
	background: #374151;
	border-radius: 4px;
	overflow: hidden;
	position: relative;
}

.spv-thumb-canvas {
	display: block;
	width: 100%;
	height: auto;
	vertical-align: top;
}

.spv-thumbs-backdrop {
	display: none;
	border: 0;
	padding: 0;
	margin: 0;
	background: rgba(15, 23, 42, 0.45);
	cursor: pointer;
}

.spv-thumbs-backdrop[hidden] {
	display: none !important;
}

@media (max-width: 768px) {
	.spv-thumbs:not([hidden]) {
		position: absolute;
		left: 0;
		top: 0;
		bottom: 0;
		width: min(200px, 82vw);
		max-width: 82vw;
		flex: none;
		box-shadow: 8px 0 24px rgba(0, 0, 0, 0.35);
	}

	.spv-thumbs-backdrop:not([hidden]) {
		display: block;
		position: absolute;
		inset: 0;
		z-index: 25;
	}
}

.spv-pages {
	position: relative;
	display: flex;
	justify-content: center;
	min-width: 100%;
}

.spv-pages--scroll {
	flex-direction: column;
	align-items: center;
	justify-content: flex-start;
	gap: 18px;
}

.spv-canvas {
	display: block;
	-webkit-user-drag: none;
	max-width: 100%;
}

.spv-page-slot {
	position: relative;
	background: #d1d5db;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
	max-width: 100%;
}

.spv-page-placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: inherit;
	color: #4b5563;
	font-size: 14px;
	padding: 24px;
	box-sizing: border-box;
}

.spv-mode-scroll .spv-viewer {
	align-items: flex-start;
}

.spv-page-wrapper {
	position: relative;
	background: #ffffff;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.18);
	max-width: 100%;
}

.spv-page-wrapper.is-locked,
.spv-page-wrapper.is-locked .spv-canvas {
	user-select: none;
	-webkit-user-select: none;
	pointer-events: none;
}

.spv-search-bar {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px;
	padding: 8px 20px;
	background: #1f2937;
	color: #ffffff;
	border-top: 1px solid #374151;
	box-sizing: border-box;
}

.spv-search-bar[hidden] {
	display: none !important;
}

.spv-search-label {
	font-size: 13px;
	color: #d1d5db;
}

.spv-search-input {
	flex: 1 1 160px;
	min-width: 120px;
	max-width: 320px;
	min-height: 36px;
	padding: 6px 10px;
	border: 1px solid #4b5563;
	border-radius: 6px;
	background: #111827;
	color: #ffffff;
	font-size: 14px;
}

.spv-search-input:focus {
	outline: 2px solid #93c5fd;
	outline-offset: 1px;
}

.spv-search-count {
	min-width: 72px;
	font-size: 13px;
	color: #d1d5db;
	text-align: center;
}

.spv-search-bar .spv-search-nav,
.spv-search-bar .spv-search-close {
	min-height: 36px;
	padding: 6px 12px;
}

.spv-no-select .spv-search-bar,
.spv-no-select .spv-search-bar * {
	user-select: text !important;
	-webkit-user-select: text !important;
	pointer-events: auto !important;
}

.spv-search-highlights {
	position: absolute;
	left: 0;
	top: 0;
	right: 0;
	bottom: 0;
	overflow: visible;
	pointer-events: none;
	z-index: 6;
}

.spv-search-measure-layer {
	opacity: 1;
	pointer-events: none !important;
	z-index: 2;
	max-width: none !important;
	user-select: none !important;
	-webkit-user-select: none !important;
}

.spv-search-measure-layer span,
.spv-search-measure-layer br {
	color: transparent !important;
}

.spv-search-hit {
	position: absolute;
	background: rgba(255, 214, 0, 0.45);
	border-radius: 2px;
	box-sizing: border-box;
	pointer-events: none;
}

.spv-search-hit.is-current {
	background: rgba(255, 128, 0, 0.55);
	outline: 2px solid rgba(234, 88, 12, 0.9);
}

@media (max-width: 768px) {
	.spv-search-bar {
		padding: 8px 12px;
	}

	.spv-search-input {
		max-width: none;
		flex: 1 1 100%;
	}
}

.spv-text-layer {
	position: absolute;
	left: 0;
	top: 0;
	right: 0;
	bottom: 0;
	overflow: hidden;
	opacity: 1;
	line-height: 1;
	transform-origin: 0 0;
	-webkit-text-size-adjust: none;
	text-size-adjust: none;
}

.spv-text-layer span,
.spv-text-layer br {
	color: transparent;
	position: absolute;
	white-space: pre;
	cursor: text;
	transform-origin: 0% 0%;
}

.spv-loading {
	position: absolute;
	top: 40px;
	left: 50%;
	transform: translateX(-50%);
	background: #111827;
	color: #ffffff;
	padding: 12px 20px;
	border-radius: 6px;
	z-index: 20;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
	max-width: calc(100% - 32px);
	text-align: center;
}

.spv-loading.spv-load-error {
	background: #7f1d1d;
}

.spv-reload {
	background: #2563eb;
}

.spv-footer {
	height: 60px;
	min-height: 60px;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 30px;
	background: #111827;
	color: #ffffff;
	user-select: none;
}

#spv-page-info {
	min-width: 100px;
	text-align: center;
	font-size: 14px;
}

.spv-error {
	padding: 40px;
	color: #b91c1c;
	font-size: 16px;
}

.spv-screen-capture {
	filter: blur(25px);
}

@media print {
	body:not(.spv-allow-print),
	body:not(.spv-allow-print) #spv-app {
		display: none !important;
	}
}

@media (max-width: 768px) {
	.spv-toolbar {
		padding: 8px 12px;
		height: auto;
		max-height: 36vh;
		overflow: auto;
		flex-direction: column;
		align-items: flex-start;
	}

	.spv-controls {
		width: 100%;
	}

	.spv-title {
		max-width: 100%;
		font-size: 14px;
	}

	.spv-viewer {
		padding: 12px;
	}

	.spv-footer {
		gap: 10px;
		height: auto;
		min-height: 52px;
		padding: 6px 8px;
		flex-wrap: wrap;
	}

	.spv-footer button {
		padding: 7px 10px;
	}

	.spv-mode-toggle {
		width: 100%;
	}

	.spv-mode-toggle button {
		flex: 1;
	}

	.spv-pages--scroll {
		gap: 12px;
	}
}
