/* =================================================================
 * Fake Low Battery / Dead Phone
 * Two fullscreen skins driven by [data-skin] on .fbat-screen:
 *   ios     — iOS lock screen + centred "Low Battery" alert
 *   android — stock Android lock screen + "Battery low" dialog
 * [data-state] drives lock -> dead (black screen + empty-battery icon).
 * Layers on top of prank-shared.css (one card + separator sections).
 * ================================================================= */

/* Declared on BOTH the page root and the overlay root on purpose — the shared
 * controller portals .fbat-overlay out to <body> on launch, so anything scoped
 * only to .fbat-page stops inheriting and var() silently falls back. */
.fbat-page,
.fbat-overlay {
	--fbat-accent: #b45309;
	--fbat-red: #ff3b30;
	--fbat-amber: #ffcc00;
}

/* ---------- Card preview (mini lock screen) ---------- */
/* Width clamp: the settings panel is taller than a 16:10 preview, and a
 * stretched aspect-ratio frame would derive its width from the row height and
 * overlap the panel. */
.fbat-preview-frame {
	background: #10131c;
	min-width: 0;
	max-width: 100%;
}

.fbat-preview {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	padding: 5% 7%;
	background:
		radial-gradient(circle at 30% 18%, rgba(255, 255, 255, 0.12), transparent 46%),
		linear-gradient(160deg, #23305a 0%, #3a2b55 52%, #1a1a2e 100%);
	color: #fff;
	font-family: -apple-system, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
	text-align: center;
}

.fbat-preview-status {
	display: flex;
	align-items: center;
	justify-content: space-between;
	font-size: clamp(8px, 1.5vw, 11px);
	font-weight: 600;
}

.fbat-preview-batt {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	color: var(--fbat-red);
}

.fbat-preview-batt-icon {
	position: relative;
	display: inline-block;
	width: clamp(16px, 3vw, 22px);
	height: clamp(8px, 1.6vw, 11px);
	border: 1.5px solid rgba(255, 255, 255, 0.55);
	border-radius: 3px;
}

.fbat-preview-batt-icon::after {
	content: '';
	position: absolute;
	right: -3px;
	top: 50%;
	transform: translateY(-50%);
	width: 2px;
	height: 40%;
	background: rgba(255, 255, 255, 0.55);
	border-radius: 0 1px 1px 0;
}

.fbat-preview-batt-icon i {
	position: absolute;
	inset: 1px;
	width: 14%;
	background: var(--fbat-red);
	border-radius: 1px;
}

.fbat-preview-time {
	margin-top: 8%;
	font-size: clamp(26px, 6vw, 46px);
	font-weight: 300;
	line-height: 1;
	letter-spacing: -0.02em;
}

.fbat-preview-alert {
	margin-top: auto;
	display: flex;
	flex-direction: column;
	gap: 2px;
	padding: 6% 8%;
	background: rgba(245, 245, 247, 0.92);
	border-radius: 12px;
	color: #111;
	font-size: clamp(8px, 1.6vw, 11px);
}

.fbat-preview-alert strong { font-size: clamp(9px, 1.8vw, 12px); }

/* ---------- Settings controls ---------- */
.fbat-select {
	width: 100%;
	padding: 9px 12px;
	font-size: 1rem;
	font-weight: 600;
	font-family: inherit;
	color: #111827;
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
	cursor: pointer;
	outline: none;
	transition: border-color var(--effect, 0.2s ease), box-shadow var(--effect, 0.2s ease);
}

.fbat-select:hover { border-color: var(--flex-gray-30, #d1d5db); }

.fbat-select:focus-visible {
	border-color: var(--fbat-accent);
	box-shadow: 0 0 0 3px rgba(180, 83, 9, 0.16);
}

.fbat-check {
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 0.95rem;
	font-weight: 600;
	color: var(--headline-fcolor, #374151);
	cursor: pointer;
	user-select: none;
}

.fbat-check input[type="checkbox"] {
	width: 18px;
	height: 18px;
	accent-color: var(--fbat-accent);
	cursor: pointer;
	flex: 0 0 18px;
}

.fbat-check input[type="checkbox"]:focus-visible {
	outline: 2px solid var(--fbat-accent);
	outline-offset: 2px;
	border-radius: 4px;
}

.fbat-page .fbat-launch-btn {
	background: var(--fbat-accent);
	border-color: var(--fbat-accent);
}

.fbat-page .fbat-launch-btn:hover {
	background: #92400e;
	border-color: #92400e;
	box-shadow: 0 4px 12px rgba(180, 83, 9, 0.28);
}

.fbat-page .fbat-launch-btn:focus-visible,
.fbat-page .prank-fullscreen-btn:focus-visible {
	outline: 2px solid var(--fbat-accent);
	outline-offset: 2px;
}

/* ---------- Safety note under the tool card ---------- */
.fbat-safety-note {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	margin: 24px 0 0;
	padding: 14px 16px;
	background: #f9fafb;
	border: 1px solid var(--prank-border);
	border-radius: 10px;
	font-size: 0.9rem;
	line-height: 1.6;
	color: var(--meta-fcolor, #4b5563);
}

.fbat-safety-note svg {
	width: 18px;
	height: 18px;
	flex: none;
	margin-top: 2px;
	color: var(--fbat-accent);
}

/* =================================================================
 * Fullscreen overlay
 * ================================================================= */
.fbat-overlay { background: #000; }

.fbat-screen {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	color: #fff;
	cursor: default;
	background:
		radial-gradient(circle at 28% 16%, rgba(255, 255, 255, 0.12), transparent 46%),
		linear-gradient(160deg, #23305a 0%, #3a2b55 52%, #1a1a2e 100%);
	font-family: -apple-system, "SF Pro Text", "SF Pro Display", "Segoe UI", system-ui, sans-serif;
}

.fbat-screen[data-skin="android"] {
	background:
		radial-gradient(circle at 72% 22%, rgba(120, 190, 255, 0.16), transparent 52%),
		linear-gradient(170deg, #0f2027 0%, #1c3b4a 55%, #10161c 100%);
	font-family: Roboto, "Segoe UI", system-ui, sans-serif;
}

/* ---------- Status bar ---------- */
.fbat-statusbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: max(2.2vh, 12px) max(4vw, 18px) 0;
	font-size: clamp(13px, 1.7vw, 17px);
	font-weight: 600;
	font-variant-numeric: tabular-nums;
}

.fbat-status-right {
	display: inline-flex;
	align-items: center;
	gap: 7px;
}

.fbat-batt-pct { font-size: 0.92em; }

.fbat-batt-icon {
	position: relative;
	display: inline-block;
	width: clamp(24px, 3vw, 34px);
	height: clamp(12px, 1.5vw, 17px);
	border: 1.6px solid rgba(255, 255, 255, 0.6);
	border-radius: 4px;
}

.fbat-batt-icon::after {
	content: '';
	position: absolute;
	right: -4px;
	top: 50%;
	transform: translateY(-50%);
	width: 2.5px;
	height: 38%;
	background: rgba(255, 255, 255, 0.6);
	border-radius: 0 2px 2px 0;
}

.fbat-batt-icon i {
	position: absolute;
	inset: 1.5px;
	width: 100%;
	background: #fff;
	border-radius: 2px;
	transition: width 0.4s linear, background 0.4s ease;
}

/* Colour thresholds mirror the real OS: amber at 20%, red at 10%. */
.fbat-screen.is-low .fbat-batt-icon i,
.fbat-screen.is-low .fbat-batt-pct { color: var(--fbat-amber); }
.fbat-screen.is-low .fbat-batt-icon i { background: var(--fbat-amber); }

.fbat-screen.is-critical .fbat-batt-icon i { background: var(--fbat-red); }
.fbat-screen.is-critical .fbat-batt-pct { color: var(--fbat-red); }

/* ---------- Lock screen ---------- */
.fbat-lock {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding-bottom: 12vh;
	text-align: center;
	text-shadow: 0 2px 18px rgba(0, 0, 0, 0.3);
}

.fbat-lock-time {
	font-size: clamp(64px, 14vw, 170px);
	font-weight: 200;
	line-height: 1;
	letter-spacing: -0.03em;
	font-variant-numeric: tabular-nums;
}

.fbat-lock-date {
	margin-top: 6px;
	font-size: clamp(15px, 2.4vw, 26px);
	font-weight: 400;
	opacity: 0.92;
}

.fbat-screen[data-skin="android"] .fbat-lock { padding-bottom: 16vh; }
.fbat-screen[data-skin="android"] .fbat-lock-time { font-weight: 300; }

/* ---------- Low-battery alert ---------- */
.fbat-alert {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: min(300px, 78vw);
	padding: 20px 18px 0;
	background: rgba(248, 248, 250, 0.97);
	backdrop-filter: blur(18px);
	-webkit-backdrop-filter: blur(18px);
	border-radius: 14px;
	color: #111;
	text-align: center;
	text-shadow: none;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
	animation: fbatAlertIn 0.18s ease-out both;
}

@keyframes fbatAlertIn {
	from { opacity: 0; transform: translate(-50%, -50%) scale(0.92); }
	to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.fbat-alert-title {
	font-size: 1.05rem;
	font-weight: 700;
}

.fbat-alert-msg {
	margin-top: 4px;
	font-size: 0.86rem;
	line-height: 1.4;
	color: #333;
}

.fbat-alert-actions {
	display: flex;
	margin-top: 18px;
	border-top: 1px solid rgba(0, 0, 0, 0.12);
}

.fbat-alert-btn {
	flex: 1;
	padding: 12px 6px;
	background: transparent;
	border: 0;
	border-radius: 0;
	color: #007aff;
	font-family: inherit;
	font-size: 0.92rem;
	cursor: pointer;
}

.fbat-alert-btn + .fbat-alert-btn { border-left: 1px solid rgba(0, 0, 0, 0.12); }
.fbat-alert-btn--primary { font-weight: 700; }
.fbat-alert-btn:hover { background: rgba(0, 0, 0, 0.04); }

.fbat-alert-btn:focus-visible {
	outline: 2px solid #007aff;
	outline-offset: -2px;
}

/* Android dialog: left-aligned, square-ish, text buttons on the right */
.fbat-screen[data-skin="android"] .fbat-alert {
	width: min(330px, 84vw);
	padding: 22px 22px 0;
	background: #2b2f33;
	color: #e8eaed;
	border-radius: 20px;
	text-align: left;
}

.fbat-screen[data-skin="android"] .fbat-alert-msg { color: #c4c7c5; }

.fbat-screen[data-skin="android"] .fbat-alert-actions {
	justify-content: flex-end;
	gap: 6px;
	margin-top: 20px;
	padding-bottom: 14px;
	border-top: 0;
}

.fbat-screen[data-skin="android"] .fbat-alert-btn {
	flex: 0 0 auto;
	padding: 9px 14px;
	border-radius: 20px;
	color: #a8c7fa;
	font-weight: 600;
	font-size: 0.86rem;
}

.fbat-screen[data-skin="android"] .fbat-alert-btn + .fbat-alert-btn { border-left: 0; }
.fbat-screen[data-skin="android"] .fbat-alert-btn:hover { background: rgba(168, 199, 250, 0.12); }

/* ---------- Dead screen ---------- */
.fbat-dead {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #000;
	opacity: 0;
	pointer-events: none;
	transition: opacity 1.1s ease;
}

.fbat-screen[data-state="dead"] .fbat-dead {
	opacity: 1;
	pointer-events: auto;
}

.fbat-dead-icon {
	width: min(180px, 42vw);
	height: auto;
	opacity: 0;
	transition: opacity 0.5s ease;
}

.fbat-screen[data-state="dead"].is-waking .fbat-dead-icon { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
	.fbat-alert { animation-duration: 1ms; }
	.fbat-dead,
	.fbat-dead-icon,
	.fbat-batt-icon i { transition-duration: 1ms; }
}

@media (max-width: 767px) {
	.fbat-safety-note { font-size: 0.85rem; }
}
