.f3b-root {
	position: relative;
	width: 100%;
	height: 100%;
	overflow: hidden;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	--f3b-chrome-bg: #1e2530;
	--f3b-chrome-text: #e8ecf1;
	--f3b-accent: #4a9eff;
	outline: none;
}

.f3b-viewport {
	position: absolute;
	inset: 0;
}

.f3b-viewport canvas {
	display: block;
	width: 100%;
	height: 100%;
}

/* Loading */

.f3b-loading {
	position: absolute;
	inset: 0;
	z-index: 50;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 16px;
	background: var(--f3b-chrome-bg);
	color: var(--f3b-chrome-text);
	transition: opacity 0.3s ease;
}

.f3b-loading.is-hidden {
	opacity: 0;
	pointer-events: none;
}

.f3b-loading-logo {
	max-width: 150px;
	max-height: 80px;
}

.f3b-spinner {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	border: 3px solid rgba(255, 255, 255, 0.25);
	border-top-color: var(--f3b-accent);
	animation: f3b-spin 0.8s linear infinite;
}

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

.f3b-error {
	max-width: 320px;
	text-align: center;
	padding: 1rem;
}

/* Toolbar */

.f3b-toolbar {
	position: absolute;
	left: 0;
	right: 0;
	z-index: 40;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 8px 14px;
	background: color-mix(in srgb, var(--f3b-chrome-bg) 88%, transparent);
	color: var(--f3b-chrome-text);
	backdrop-filter: blur(6px);
}

.f3b-toolbar--bottom-center,
.f3b-toolbar--bottom-full {
	bottom: 0;
}

.f3b-toolbar--top-center,
.f3b-toolbar--top-full {
	top: 0;
}

.f3b-toolbar--bottom-center,
.f3b-toolbar--top-center {
	max-width: 640px;
	margin: 12px auto;
	border-radius: 999px;
	left: 50%;
	right: auto;
	transform: translateX(-50%);
}

.f3b-toolbar-group {
	display: flex;
	align-items: center;
	gap: 4px;
}

.f3b-toolbar-logo {
	max-height: 24px;
	margin-right: 8px;
}

.f3b-btn {
	appearance: none;
	border: none;
	background: transparent;
	color: inherit;
	font-size: 16px;
	line-height: 1;
	width: 34px;
	height: 34px;
	border-radius: 8px;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: background 0.15s ease;
}

.f3b-btn:hover,
.f3b-btn.is-active {
	background: color-mix(in srgb, var(--f3b-accent) 30%, transparent);
}

.f3b-page-indicator {
	appearance: none;
	border: none;
	background: transparent;
	color: inherit;
	font-size: 13px;
	padding: 0 10px;
	cursor: pointer;
	white-space: nowrap;
}

/* Search */

.f3b-search-panel {
	position: absolute;
	top: 12px;
	right: 12px;
	z-index: 41;
	display: none;
	align-items: center;
	gap: 6px;
	background: var(--f3b-chrome-bg);
	color: var(--f3b-chrome-text);
	padding: 6px 10px;
	border-radius: 8px;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.f3b-search-panel.is-open {
	display: flex;
}

.f3b-search-input {
	background: rgba(255, 255, 255, 0.08);
	border: 1px solid rgba(255, 255, 255, 0.2);
	color: inherit;
	border-radius: 6px;
	padding: 4px 8px;
	width: 180px;
}

.f3b-search-count {
	font-size: 12px;
	opacity: 0.75;
	white-space: nowrap;
}

/* Thumbnails */

.f3b-thumb-panel {
	position: absolute;
	top: 0;
	bottom: 0;
	left: 0;
	width: 0;
	overflow-y: auto;
	overflow-x: hidden;
	background: var(--f3b-chrome-bg);
	z-index: 39;
	transition: width 0.2s ease;
	display: grid;
	grid-template-columns: 1fr;
	gap: 8px;
	padding: 0;
}

.f3b-thumb-panel.is-open {
	width: 140px;
	padding: 12px 8px;
}

.f3b-thumb-item {
	appearance: none;
	border: 2px solid transparent;
	background-size: cover;
	background-position: center;
	background-color: rgba(255, 255, 255, 0.06);
	aspect-ratio: 3 / 4;
	border-radius: 4px;
	color: var(--f3b-chrome-text);
	font-size: 11px;
	cursor: pointer;
}

.f3b-thumb-item.is-active {
	border-color: var(--f3b-accent);
}

/* Watermark */

.f3b-watermark-layer {
	position: absolute;
	inset: 0;
	z-index: 30;
	pointer-events: none;
	overflow: hidden;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: var(--f3b-wm-opacity, 0.25);
}

.f3b-watermark-grid {
	transform: rotate(var(--f3b-wm-rotation, 30deg));
	color: var(--f3b-wm-color, #888);
	font-size: var(--f3b-wm-font-size, 42px);
	font-weight: 700;
	white-space: nowrap;
}

.f3b-watermark-row {
	white-space: nowrap;
}

/* Restrictions */

.f3b-no-select,
.f3b-no-select * {
	user-select: none;
	-webkit-user-select: none;
}

.f3b-devtools-warning::after {
	content: "Developer tools detected — content protection active.";
	position: absolute;
	inset: 0;
	z-index: 60;
	display: flex;
	align-items: center;
	justify-content: center;
	text-align: center;
	padding: 2rem;
	background: rgba(10, 10, 12, 0.92);
	color: #fff;
}

/* Password gate */

.f3b-password-gate {
	position: absolute;
	inset: 0;
	z-index: 70;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--f3b-chrome-bg);
	color: var(--f3b-chrome-text);
}

.f3b-password-form {
	display: flex;
	flex-direction: column;
	gap: 10px;
	width: 240px;
	text-align: center;
}

.f3b-password-input {
	padding: 8px 10px;
	border-radius: 6px;
	border: 1px solid rgba(255, 255, 255, 0.25);
	background: rgba(255, 255, 255, 0.08);
	color: inherit;
}

.f3b-password-submit {
	padding: 8px 10px;
	border-radius: 6px;
	border: none;
	background: var(--f3b-accent);
	color: #fff;
	cursor: pointer;
	font-weight: 600;
}

.f3b-password-error {
	color: #ff8080;
	font-size: 13px;
	margin: 0;
}

/* Theme */

.f3b-theme-light {
	background: #fff;
}

.f3b-theme-dark {
	background: #0f0f12;
}
