/* LW P2P - direct transfer between nearby devices (js/lw_p2p.js).
   z-index above 999: scripts.js lays a page-wide drop overlay at 999 while a file is dragged,
   and the devices must stay droppable on top of it. */

.lw-p2p-ring {
	position: absolute;
	inset: 0;
	pointer-events: none;
	z-index: 1002;
}
.lw-p2p-peer {
	font: inherit;
	color: #334133;
	background: none;
	border: 0;
	padding: 0;
	cursor: pointer;
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	pointer-events: auto;
}
.lw-p2p-spot {
	position: absolute;
	width: 76px;
	animation: lw-p2p-in .35s ease-out;
}
@keyframes lw-p2p-in {
	from { opacity: 0; transform: scale(.6); }
	to { opacity: 1; transform: scale(1); }
}
.lw-p2p-av {
	--size: 76px;
	position: relative;
	width: var(--size);
	height: var(--size);
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 0 18px rgba(0, 0, 0, .14);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform .15s ease, box-shadow .15s ease;
}
.lw-p2p-av svg {
	width: 46%;
	height: 46%;
	fill: none;
	stroke: #00934a;
	stroke-width: 1.6;
	stroke-linecap: round;
}
.lw-p2p-peer:hover .lw-p2p-av,
.lw-p2p-peer:focus-visible .lw-p2p-av,
.lw-p2p-drop .lw-p2p-av {
	transform: scale(1.08);
	box-shadow: 0 0 0 4px #bef100, 0 0 22px rgba(0, 147, 74, .35);
}
.lw-p2p-progress {
	position: absolute;
	inset: -5px;
	border-radius: 50%;
	opacity: 0;
	background: conic-gradient(#00934a calc(var(--lw-p2p-progress, 0) * 360deg), rgba(0, 147, 74, .12) 0);
	-webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px));
	mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px));
	transition: opacity .2s;
}
.lw-p2p-busy .lw-p2p-progress { opacity: 1; }
.lw-p2p-name {
	margin-top: 8px;
	font-size: 13px;
	font-weight: 600;
	max-width: 130px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.lw-p2p-sub {
	font-size: 11px;
	color: #6b776b;
	white-space: nowrap;
}

/* Status under the upload circle. Narrower than the ring's inner slots. */
.lw-p2p-bar {
	position: relative;
	z-index: 1002;
	max-width: 340px;
	margin: 22px auto 0;
	text-align: center;
	color: #334133;
	font-size: 14px;
	line-height: 1.4;
}
.lw-p2p-row {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 8px;
	margin-bottom: 10px;
}
.lw-p2p-row:empty { display: none; }
.lw-p2p-chip.lw-p2p-ringed { display: none; }
.lw-p2p-chip {
	flex-direction: row;
	gap: 8px;
	padding: 4px 12px 4px 4px;
	border-radius: 24px;
	background: #fff;
	box-shadow: 0 0 10px rgba(0, 0, 0, .1);
	text-align: left;
}
.lw-p2p-chip .lw-p2p-av { --size: 36px; box-shadow: none; background: #f1f7f1; }
.lw-p2p-chip .lw-p2p-name { margin-top: 0; max-width: 140px; }
.lw-p2p-chip .lw-p2p-sub { display: none; }
.lw-p2p-hint { margin: 0 0 10px; text-wrap: balance; }
.lw-p2p-bar[data-state="connecting"] .lw-p2p-hint,
.lw-p2p-bar[data-state="offline"] .lw-p2p-hint { color: #6b776b; }
.lw-p2p-warn {
	margin: 10px 0 0;
	padding: 8px 10px;
	border-radius: 8px;
	background: #fff6d6;
	color: #5c4a00;
	font-size: 13px;
}
.lw-p2p-me { margin: 8px 0 0; font-size: 12px; color: #6b776b; }
.lw-p2p-rename,
.lw-p2p-linkbtn {
	font: inherit;
	color: #00934a;
	background: none;
	border: 0;
	padding: 0;
	cursor: pointer;
	text-decoration: underline dotted;
}
.lw-p2p-rename-input {
	font: inherit;
	width: 150px;
	padding: 2px 6px;
	border: 1px solid #00934a;
	border-radius: 4px;
}
.lw-p2p-pairbtn,
.lw-p2p-btn {
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	border-radius: 20px;
	padding: 8px 18px;
	border: 1px solid #00934a;
	background: #00934a;
	color: #fff;
}
.lw-p2p-pairbtn {
	background: #fff;
	color: #00934a;
}
.lw-p2p-pairbtn.lw-p2p-attention {
	background: #00934a;
	color: #fff;
	animation: lw-p2p-pulse 1.8s ease-in-out infinite;
}
@keyframes lw-p2p-pulse {
	0%, 100% { box-shadow: 0 0 0 0 rgba(0, 147, 74, .4); }
	50% { box-shadow: 0 0 0 8px rgba(0, 147, 74, 0); }
}
.lw-p2p-ghost { background: #fff; color: #00934a; }
.lw-p2p-btn:hover, .lw-p2p-pairbtn:hover { filter: brightness(1.06); }

/* Transfer cards - bottom right on a computer, above the footer on a phone. */
.lw-p2p-cards {
	position: fixed;
	right: 16px;
	bottom: 60px;
	z-index: 1003;
	width: 340px;
	max-width: calc(100vw - 32px);
	max-height: calc(100vh - 140px);
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	gap: 10px;
}
.lw-p2p-card {
	position: relative;
	background: #fff;
	color: #334133;
	border-radius: 12px;
	box-shadow: 0 6px 28px rgba(0, 0, 0, .18);
	padding: 14px 16px;
	font-size: 14px;
	line-height: 1.4;
	animation: lw-p2p-in .2s ease-out;
}
.lw-p2p-card[data-state="offer"] { border-left: 4px solid #00934a; }
.lw-p2p-card[data-state="failed"] { border-left: 4px solid #d64545; }
.lw-p2p-title { margin: 0 0 6px; font-weight: 600; word-break: break-word; }
.lw-p2p-toast .lw-p2p-title { margin: 0 20px 0 0; font-weight: 500; }
.lw-p2p-note { margin: 0 0 6px; color: #556155; font-size: 13px; }
.lw-p2p-alert { color: #8a5a00; }
.lw-p2p-error { color: #b42318; min-height: 1em; }
.lw-p2p-files { list-style: none; margin: 6px 0; padding: 0; max-height: 220px; overflow-y: auto; }
.lw-p2p-files li {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 3px 0;
	font-size: 13px;
}
.lw-p2p-fname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lw-p2p-fsize { color: #6b776b; white-space: nowrap; }
.lw-p2p-exec .lw-p2p-fname::before { content: "\26A0\FE0E  "; color: #b42318; }
.lw-p2p-save { color: #00934a; font-weight: 600; text-decoration: none; white-space: nowrap; }
.lw-p2p-save:hover { text-decoration: underline; }
.lw-p2p-track { height: 6px; border-radius: 3px; background: #e5efe5; overflow: hidden; margin: 8px 0 4px; }
.lw-p2p-fill { height: 100%; width: 0; background: #00934a; transition: width .3s linear; }
.lw-p2p-pct { margin: 0 0 6px; font-size: 12px; color: #6b776b; }
.lw-p2p-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.lw-p2p-actions .lw-p2p-btn { padding: 6px 14px; font-size: 13px; }
.lw-p2p-x {
	position: absolute;
	top: 6px;
	right: 8px;
	font-size: 20px;
	line-height: 1;
	border: 0;
	background: none;
	color: #6b776b;
	cursor: pointer;
}

/* Pairing dialog */
.lw-p2p-modal {
	position: fixed;
	inset: 0;
	z-index: 1004;
	background: rgba(20, 30, 20, .45);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
}
.lw-p2p-modal[hidden] { display: none; }
.lw-p2p-modal-box {
	position: relative;
	background: #fff;
	color: #334133;
	border-radius: 14px;
	padding: 24px;
	width: 440px;
	max-width: 100%;
	max-height: calc(100vh - 32px);
	overflow-y: auto;
	box-shadow: 0 10px 40px rgba(0, 0, 0, .25);
}
.lw-p2p-modal-title { margin: 0 0 16px; font-size: 20px; }
.lw-p2p-pair-show { display: flex; gap: 18px; align-items: center; }
.lw-p2p-qr { flex: 0 0 150px; width: 150px; height: 150px; background: #f4f7f4; border-radius: 8px; }
.lw-p2p-qr svg { width: 100%; height: 100%; display: block; }
.lw-p2p-pair-side { flex: 1; min-width: 0; }
.lw-p2p-code {
	margin: 6px 0 2px;
	font-size: 34px;
	font-weight: 700;
	letter-spacing: 4px;
	font-variant-numeric: tabular-nums;
	color: #00934a;
}
.lw-p2p-or { margin: 20px 0 8px; font-weight: 600; }
.lw-p2p-join { display: flex; gap: 8px; }
.lw-p2p-code-input {
	flex: 1;
	min-width: 0;
	font: inherit;
	font-size: 20px;
	letter-spacing: 3px;
	padding: 6px 12px;
	border: 1px solid #b9c7b9;
	border-radius: 8px;
}
.lw-p2p-code-input:focus { outline: 2px solid #00934a; border-color: #00934a; }
.lw-p2p-linked { margin-top: 12px; }
.lw-p2p-picker { display: none; }

/* The ring needs height and width; below these the devices live in the row under the circle. */
@media screen and (max-height: 900px), screen and (max-width: 768px) {
	.lw-p2p-ring { display: none; }
	.lw-p2p-chip.lw-p2p-ringed { display: flex; }
}
/* The theme pins the "You / name" caption of the radar centre to bottom: 90px, right on top of
   the fixed footer line. The status line ("You appear as ...") already says who you are. */
.user.you .peer .user-info {
	display: none;
}

@media screen and (max-width: 768px) {
	/* style.css pins the phone column at both ends (bottom: 50px plus the top: 28% of its
	   max-height rules), so the device list spilled out under the fixed footer. Anchored to the
	   bottom only, the column grows upwards and clears the 66px footer. */
	body .main_content {
		top: auto;
		bottom: 70px;
	}
	/* .lw-seo starts at top: 100vh, but on phones .l-content ends at 810px (margin-top 210px plus
	   min-height 600px), so on screens shorter than that the copy covered the device list. */
	body .lw-seo {
		top: max(100vh, 810px);
	}
	.lw-p2p-bar { margin-top: 14px; padding: 0 16px; max-width: none; font-size: 13px; }
	.lw-p2p-cards { left: 12px; right: 12px; width: auto; max-width: none; bottom: 60px; }
	.lw-p2p-pair-show { flex-direction: column; text-align: center; }
	.lw-p2p-qr { flex-basis: auto; width: 170px; height: 170px; }
}
