/* ============================================================
   LED Pixel Pitch Visualizer — frontend styles
   Scoped to .lppv-root. Safe to drop into any theme.
   ============================================================ */

.lppv-root,
.lppv-root *,
.lppv-root *::before,
.lppv-root *::after {
	box-sizing: border-box;
}

.lppv-root {
	--lppv-bg1: #0b1220;
	--lppv-bg2: #111a2f;
	--lppv-card: rgba(20, 28, 48, 0.72);
	--lppv-card-2: rgba(13, 20, 38, 0.55);
	--lppv-border: rgba(148, 163, 184, 0.18);
	--lppv-border-strong: rgba(148, 163, 184, 0.34);
	--lppv-text: #e6ecf5;
	--lppv-muted: #94a3b8;
	--lppv-accent1: #60a5fa;
	--lppv-accent2: #a78bfa;
	--lppv-good: #22c55e;
	--lppv-warn: #f59e0b;
	--lppv-hot: #f97316;
	--lppv-pink: #f472b6;
	--lppv-yellow: #facc15;
	--lppv-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
	--lppv-radius: 18px;

	position: relative;
	display: block;
	max-width: 1480px;
	margin: 0 auto;
	padding: clamp(12px, 2vw, 24px);
	color: var(--lppv-text);
	font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 14px;
	line-height: 1.45;
}

.lppv-root .lppv-config { display: none; }

/* Cards ----------------------------------------------------- */
.lppv-card {
	position: relative;
	background:
		linear-gradient(rgba(20, 28, 48, 0.72), rgba(20, 28, 48, 0.72)),
		radial-gradient(1200px 700px at 12% 8%, rgba(96, 165, 250, 0.18), transparent 55%),
		radial-gradient(900px 600px at 88% 22%, rgba(167, 139, 250, 0.18), transparent 55%),
		linear-gradient(135deg, var(--lppv-bg1), var(--lppv-bg2), var(--lppv-bg1));
	border: 1px solid var(--lppv-border);
	border-radius: var(--lppv-radius);
	box-shadow: var(--lppv-shadow);
	padding: clamp(14px, 2vw, 22px);
	overflow: hidden;
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
}

.lppv-card-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 14px;
}

.lppv-card-title {
	margin: 0;
	font-size: clamp(15px, 1.3vw, 17px);
	font-weight: 800;
	letter-spacing: -0.01em;
	color: #f1f5f9;
}

.lppv-card-sub {
	margin: 4px 0 0;
	color: var(--lppv-muted);
	font-size: 12.5px;
	max-width: 60ch;
}

/* Layout grid ---------------------------------------------- */
.lppv-grid {
	display: grid;
	gap: 14px;
	grid-template-columns: 1fr;
	align-items: start;
}
@media (min-width: 1024px) {
	.lppv-grid { grid-template-columns: 380px minmax(0, 1fr); }
}
@media (min-width: 1280px) {
	.lppv-grid { grid-template-columns: 420px minmax(0, 1fr); }
}

.lppv-wallcard { margin-top: 14px; }

/* Generic blocks ------------------------------------------- */
.lppv-block { margin: 14px 0 0; }
.lppv-block:first-child { margin-top: 0; }

.lppv-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin-bottom: 6px;
}

.lppv-label {
	font-weight: 700;
	font-size: 12.5px;
	letter-spacing: 0.01em;
	color: #f1f5f9;
}

.lppv-hint {
	font-size: 12px;
	color: var(--lppv-muted);
	font-variant-numeric: tabular-nums;
}

.lppv-helper {
	margin: 8px 0 0;
	color: var(--lppv-muted);
	font-size: 12px;
}

/* Buttons / icon button ------------------------------------ */
.lppv-iconbtn {
	width: 32px;
	height: 32px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: 999px;
	border: 1px solid var(--lppv-border-strong);
	background: rgba(2, 6, 23, 0.45);
	color: var(--lppv-text);
	cursor: pointer;
	transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}
.lppv-iconbtn:hover { background: rgba(2, 6, 23, 0.65); border-color: rgba(148, 163, 184, 0.5); transform: translateY(-1px); }

/* Select --------------------------------------------------- */
.lppv-select {
	width: 100%;
	padding: 10px 12px;
	border-radius: 12px;
	border: 1px solid var(--lppv-border-strong);
	background: rgba(2, 6, 23, 0.55);
	color: var(--lppv-text);
	font-size: 13px;
	outline: none;
	cursor: pointer;
	appearance: none;
	background-image: linear-gradient(45deg, transparent 50%, #94a3b8 50%), linear-gradient(135deg, #94a3b8 50%, transparent 50%);
	background-position: calc(100% - 18px) 18px, calc(100% - 13px) 18px;
	background-size: 5px 5px, 5px 5px;
	background-repeat: no-repeat;
	transition: border-color 0.2s ease;
}
.lppv-select:hover { border-color: rgba(148, 163, 184, 0.5); }
.lppv-select:focus { border-color: var(--lppv-accent1); box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.15); }

/* Range ---------------------------------------------------- */
.lppv-range {
	width: 100%;
	-webkit-appearance: none;
	appearance: none;
	height: 6px;
	border-radius: 999px;
	background: linear-gradient(90deg, rgba(96, 165, 250, 0.6) 0%, rgba(167, 139, 250, 0.6) 50%, rgba(148, 163, 184, 0.2) 50%);
	outline: none;
	cursor: pointer;
}
.lppv-range::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: linear-gradient(135deg, #a78bfa, #6366f1);
	cursor: pointer;
	box-shadow: 0 4px 14px rgba(124, 58, 237, 0.45), 0 0 0 4px rgba(255, 255, 255, 0.08);
	border: 2px solid rgba(255, 255, 255, 0.95);
	transition: transform 0.15s ease, box-shadow 0.2s ease;
}
.lppv-range::-webkit-slider-thumb:hover { transform: scale(1.1); }
.lppv-range::-webkit-slider-thumb:active { transform: scale(1.05); }
.lppv-range::-moz-range-thumb {
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: linear-gradient(135deg, #a78bfa, #6366f1);
	cursor: pointer;
	border: 2px solid #fff;
	box-shadow: 0 4px 14px rgba(124, 58, 237, 0.45);
}

.lppv-range-distance {
	background: linear-gradient(90deg, rgba(34, 197, 94, 0.6) 0%, rgba(250, 204, 21, 0.6) 50%, rgba(249, 115, 22, 0.5) 100%);
}

/* Preset chips -------------------------------------------- */
.lppv-pitch-tags,
.lppv-distance-tags {
	display: flex;
	gap: 6px;
	flex-wrap: wrap;
	margin-top: 10px;
}
.lppv-pitch-tags button,
.lppv-distance-tags button {
	font: inherit;
	font-size: 11.5px;
	font-weight: 700;
	color: var(--lppv-text);
	background: rgba(2, 6, 23, 0.45);
	border: 1px solid var(--lppv-border);
	border-radius: 999px;
	padding: 5px 10px;
	cursor: pointer;
	transition: all 0.15s ease;
	font-variant-numeric: tabular-nums;
}
.lppv-pitch-tags button:hover,
.lppv-distance-tags button:hover {
	border-color: rgba(167, 139, 250, 0.65);
	background: rgba(2, 6, 23, 0.7);
	transform: translateY(-1px);
}
.lppv-pitch-tags button.is-active,
.lppv-distance-tags button.is-active {
	background: linear-gradient(135deg, rgba(96, 165, 250, 0.22), rgba(167, 139, 250, 0.22));
	border-color: rgba(167, 139, 250, 0.8);
	color: #fff;
}

/* Category pill ------------------------------------------- */
.lppv-category {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin-top: 10px;
	font-size: 12px;
	padding: 7px 12px;
	border-radius: 999px;
	border: 1px solid var(--lppv-border);
	background: rgba(2, 6, 23, 0.4);
	color: rgba(226, 232, 240, 0.95);
}

.lppv-dot {
	width: 8px;
	height: 8px;
	border-radius: 999px;
	background: rgba(34, 197, 94, 0.95);
	box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.18);
	transition: background 0.25s ease, box-shadow 0.25s ease;
}
.lppv-dot-live {
	background: var(--lppv-good);
	animation: lppv-pulse 1.6s ease-in-out infinite;
}
@keyframes lppv-pulse {
	0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.45); }
	50%      { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
}

/* Reference card ----------------------------------------- */
.lppv-ref-stage {
	margin-top: 10px;
	display: flex;
	justify-content: center;
	align-items: center;
	padding: 14px;
	border-radius: 16px;
	background:
		repeating-linear-gradient(45deg, rgba(250, 204, 21, 0.04) 0 10px, transparent 10px 20px),
		radial-gradient(circle at 50% 50%, rgba(250, 204, 21, 0.1), transparent 70%),
		rgba(0, 0, 0, 0.4);
	border: 1px dashed rgba(250, 204, 21, 0.4);
	min-height: 160px;
	overflow: hidden;
}
.lppv-ref-svg {
	transform-origin: center center;
	transition: width 0.25s ease, height 0.25s ease;
	max-width: 100%;
	max-height: 240px;
}
.lppv-ref-svg svg { display: block; width: 100%; height: 100%; }

.lppv-ref-meta {
	margin-top: 10px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
}
.lppv-ref-name { font-weight: 800; font-size: 13px; }
.lppv-ref-size { color: var(--lppv-muted); font-size: 12px; margin-top: 2px; }

.lppv-how {
	margin-top: 12px;
	padding: 12px 14px;
	border-radius: 14px;
	border: 1px solid var(--lppv-border);
	background: rgba(2, 6, 23, 0.42);
	font-size: 12.5px;
}
.lppv-how-title { font-weight: 800; margin-bottom: 6px; }
.lppv-how ol { margin: 0; padding-left: 18px; color: rgba(226, 232, 240, 0.92); }
.lppv-how li + li { margin-top: 4px; }

/* Toggles -------------------------------------------------- */
.lppv-toggles { display: grid; gap: 8px; }
.lppv-toggle {
	display: flex;
	align-items: center;
	gap: 12px;
	width: 100%;
	padding: 12px 14px;
	border-radius: 14px;
	border: 1px solid var(--lppv-border-strong);
	background: rgba(2, 6, 23, 0.4);
	color: var(--lppv-text);
	cursor: pointer;
	text-align: left;
	transition: all 0.18s ease;
}
.lppv-toggle:hover {
	border-color: rgba(148, 163, 184, 0.5);
	background: rgba(2, 6, 23, 0.55);
	transform: translateY(-1px);
}
.lppv-toggle[aria-pressed="true"] {
	background: linear-gradient(135deg, rgba(34, 197, 94, 0.18), rgba(2, 6, 23, 0.4));
	border-color: rgba(34, 197, 94, 0.45);
}
.lppv-toggle-icon {
	width: 32px;
	height: 32px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: 9px;
	background: rgba(255, 255, 255, 0.06);
	font-size: 16px;
}
.lppv-toggle[aria-pressed="true"] .lppv-toggle-icon {
	background: rgba(34, 197, 94, 0.22);
	color: #d1fae5;
}
.lppv-toggle-body { display: flex; flex-direction: column; }
.lppv-toggle-title { font-weight: 700; font-size: 13px; }
.lppv-toggle-sub { color: var(--lppv-muted); font-size: 11.5px; margin-top: 2px; }

/* Stats ---------------------------------------------------- */
.lppv-stats {
	display: grid;
	gap: 8px;
	margin-top: 14px;
	grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media (max-width: 480px) {
	.lppv-stats { grid-template-columns: 1fr; }
}
.lppv-stat {
	padding: 10px 12px;
	border-radius: 14px;
	border: 1px solid var(--lppv-border);
	background: rgba(2, 6, 23, 0.4);
	transition: transform 0.18s ease;
}
.lppv-stat:hover { transform: translateY(-2px); }
.lppv-stat.blue   { background: linear-gradient(135deg, rgba(96, 165, 250, 0.22), rgba(2, 6, 23, 0.45)); }
.lppv-stat.purple { background: linear-gradient(135deg, rgba(167, 139, 250, 0.22), rgba(2, 6, 23, 0.45)); }
.lppv-stat.green  { background: linear-gradient(135deg, rgba(34, 197, 94, 0.22), rgba(2, 6, 23, 0.45)); }
.lppv-stat.amber  { background: linear-gradient(135deg, rgba(245, 158, 11, 0.22), rgba(2, 6, 23, 0.45)); }
.lppv-stat.sky    { background: linear-gradient(135deg, rgba(56, 189, 248, 0.22), rgba(2, 6, 23, 0.45)); }
.lppv-stat.pink   { background: linear-gradient(135deg, rgba(244, 114, 182, 0.22), rgba(2, 6, 23, 0.45)); }
.lppv-stat-k { font-size: 10.5px; color: rgba(226, 232, 240, 0.85); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.06em; }
.lppv-stat-v { font-size: clamp(13px, 1.2vw, 15px); font-weight: 850; line-height: 1.15; font-variant-numeric: tabular-nums; }
.lppv-stat-s { font-size: 10.5px; color: var(--lppv-muted); margin-top: 2px; }

/* Preview stage ------------------------------------------- */
.lppv-stage-wrap { padding: 6px 0 4px; }
.lppv-stage {
	position: relative;
	width: 100%;
	aspect-ratio: 1 / 1;
	max-height: 78vh;
	margin: 0 auto;
	background: #000;
	border-radius: 18px;
	overflow: hidden;
	border: 1px solid var(--lppv-border-strong);
	box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
}
.lppv-video-canvas {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	image-rendering: pixelated;
	image-rendering: -moz-crisp-edges;
	image-rendering: crisp-edges;
}
.lppv-grid-overlay,
.lppv-wall-grid {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
}
.lppv-hud {
	position: absolute;
	left: 12px;
	bottom: 12px;
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
	z-index: 5;
}
.lppv-pill {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	font-size: 11.5px;
	padding: 6px 11px;
	border-radius: 999px;
	border: 1px solid var(--lppv-border-strong);
	background: rgba(2, 6, 23, 0.6);
	color: rgba(226, 232, 240, 0.95);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
}
.lppv-pill strong { font-variant-numeric: tabular-nums; }

.lppv-play {
	position: absolute;
	right: 12px;
	bottom: 12px;
	padding: 10px 16px;
	border-radius: 999px;
	border: 1px solid var(--lppv-border-strong);
	background: rgba(2, 6, 23, 0.7);
	color: var(--lppv-text);
	font: inherit;
	font-size: 12px;
	cursor: pointer;
}
.lppv-loading {
	position: absolute;
	inset: 0;
	display: none;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.7);
	z-index: 10;
}
.lppv-loading.is-active { display: flex; }
.lppv-spinner {
	width: 36px;
	height: 36px;
	border: 3px solid rgba(148, 163, 184, 0.2);
	border-top-color: var(--lppv-accent1);
	border-radius: 50%;
	animation: lppv-spin 1s linear infinite;
}
@keyframes lppv-spin { to { transform: rotate(360deg); } }

.lppv-video { display: none; }

/* ============================================================
   3D Wall scene
   ============================================================ */
.lppv-wall-head {
	flex-wrap: wrap;
	gap: 12px;
}
.lppv-wall-hud {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
}

.lppv-wall-scene {
	position: relative;
	width: 100%;
	height: clamp(380px, 60vh, 640px);
	border-radius: 18px;
	overflow: hidden;
	background:
		radial-gradient(80% 50% at 50% 30%, rgba(96, 165, 250, 0.10), transparent 75%),
		radial-gradient(60% 40% at 50% 100%, rgba(0, 0, 0, 0.6), transparent 70%),
		linear-gradient(180deg, #0a1530 0%, #06091a 55%, #02030a 100%);
	border: 1px solid var(--lppv-border-strong);
	box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.5), 0 30px 60px rgba(0, 0, 0, 0.5);
	perspective: 1400px;
	perspective-origin: 50% 45%;
}

/* Floor */
.lppv-floor {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 60%;
	transform: rotateX(72deg) translateZ(0);
	transform-origin: 50% 100%;
	background:
		linear-gradient(180deg, rgba(11, 16, 32, 0) 0%, rgba(11, 16, 32, 0.85) 75%, #06091a 100%);
}
.lppv-floor-grid {
	position: absolute;
	inset: 0;
	background-image:
		linear-gradient(rgba(96, 165, 250, 0.20) 1px, transparent 1px),
		linear-gradient(90deg, rgba(96, 165, 250, 0.20) 1px, transparent 1px);
	background-size: 80px 80px;
	mask-image: linear-gradient(180deg, transparent 0%, #000 30%, #000 90%, transparent 100%);
	-webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 30%, #000 90%, transparent 100%);
}
.lppv-floor-haze {
	position: absolute;
	inset: 0;
	background: radial-gradient(40% 30% at 50% 0%, rgba(96, 165, 250, 0.18), transparent 70%);
}

/* Wall (positioned & scaled by JS for walk-back illusion) */
.lppv-wall-stage {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	transform-style: preserve-3d;
}

.lppv-wall {
	position: relative;
	will-change: transform, width, height;
	transition: width 0.18s ease, height 0.18s ease, filter 0.25s ease;
	filter: drop-shadow(0 30px 50px rgba(0, 0, 0, 0.6));
}

.lppv-wall-bezel {
	position: relative;
	width: 100%;
	height: 100%;
	padding: 10px;
	border-radius: 10px;
	background: linear-gradient(180deg, #1a2236 0%, #0a0f1d 100%);
	border: 1px solid rgba(148, 163, 184, 0.28);
	box-shadow:
		inset 0 0 0 1px rgba(0, 0, 0, 0.4),
		0 0 0 1px rgba(255, 255, 255, 0.04),
		0 40px 90px rgba(0, 0, 0, 0.55);
	overflow: hidden;
}
.lppv-wall-canvas {
	position: absolute;
	inset: 10px;
	width: calc(100% - 20px);
	height: calc(100% - 20px);
	image-rendering: pixelated;
	image-rendering: -moz-crisp-edges;
	image-rendering: crisp-edges;
	border-radius: 4px;
	background: #000;
}
.lppv-wall-grid {
	position: absolute;
	inset: 10px;
	width: calc(100% - 20px);
	height: calc(100% - 20px);
	border-radius: 4px;
}
.lppv-wall-glow {
	position: absolute;
	inset: 0;
	pointer-events: none;
	background:
		radial-gradient(60% 50% at 50% 100%, rgba(96, 165, 250, 0.2), transparent 70%);
	mix-blend-mode: screen;
}

/* Person silhouette + tag */
.lppv-person {
	position: absolute;
	left: 50%;
	bottom: 6%;
	width: 36px;
	height: 84px;
	transform: translate(-50%, 0);
	transition: transform 0.2s ease, width 0.2s ease, height 0.2s ease, opacity 0.2s ease;
	pointer-events: none;
	filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.45));
	will-change: transform, width, height;
}
.lppv-person svg { width: 100%; height: 100%; display: block; }

.lppv-person-label {
	position: absolute;
	left: 50%;
	bottom: calc(100% + 6px);
	transform: translateX(-50%);
	font-size: 11px;
	padding: 4px 9px;
	border-radius: 999px;
	background: rgba(2, 6, 23, 0.75);
	color: #fff;
	border: 1px solid var(--lppv-border-strong);
	white-space: nowrap;
	backdrop-filter: blur(6px);
}

/* Wall controls bar */
.lppv-wall-controls {
	margin-top: 14px;
	display: grid;
	gap: 14px;
	grid-template-columns: 1fr;
}
@media (min-width: 900px) {
	.lppv-wall-controls { grid-template-columns: 1.4fr 1fr; align-items: end; }
}

.lppv-wall-readouts {
	display: grid;
	gap: 8px;
	grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media (max-width: 540px) {
	.lppv-wall-readouts { grid-template-columns: 1fr; }
}

/* Status colors for the rule-of-10 readout */
.lppv-stat[data-rule-state="good"]    { background: linear-gradient(135deg, rgba(34, 197, 94, 0.22), rgba(2, 6, 23, 0.45)); border-color: rgba(34, 197, 94, 0.45); }
.lppv-stat[data-rule-state="ok"]      { background: linear-gradient(135deg, rgba(250, 204, 21, 0.22), rgba(2, 6, 23, 0.45)); border-color: rgba(250, 204, 21, 0.45); }
.lppv-stat[data-rule-state="too-close"] { background: linear-gradient(135deg, rgba(249, 115, 22, 0.25), rgba(2, 6, 23, 0.45)); border-color: rgba(249, 115, 22, 0.5); }

/* Small screens: tighten the calibration card padding */
@media (max-width: 540px) {
	.lppv-card { padding: 14px; }
	.lppv-stage { max-height: 56vh; }
}
