/* Isolated friends widget. All selectors are scoped under .ofw; no launcher stylesheet changes are required.
   Hard edges + slanted plates follow the native launcher. Theme colours come from theme.css with safe fallbacks. */
.ofw {
	--ofw-bg: var(--c-bg, #090816);
	--ofw-panel: var(--c-panel, #15132c);
	--ofw-panel-hi: var(--c-panel-hi, #201d3d);
	--ofw-line: var(--c-line, #393354);
	--ofw-text: var(--c-text, #f4f2ff);
	--ofw-dim: var(--c-dim, #aaa5c2);
	--ofw-faint: var(--c-faint, #77718f);
	--ofw-cyan: var(--c-cyan, #28f9dd);
	--ofw-magenta: var(--c-magenta, #ef5dff);
	--ofw-coral: var(--c-coral, #ff705e);
	position: fixed;
	right: max(20px, env(safe-area-inset-right));
	bottom: calc(54px + env(safe-area-inset-bottom));
	z-index: 30;
	width: min(900px, calc(100vw - 40px));
	color: var(--ofw-text);
	font: 400 15px/1.4 "OdinES Noto", "Noto Sans", system-ui, sans-serif;
	pointer-events: none;
}
.ofw, .ofw * { box-sizing: border-box; }
.ofw [hidden] { display: none !important; }
.ofw button, .ofw input, .ofw textarea { font: inherit; color: inherit; border-radius: 0; }
.ofw button, .ofw input, .ofw textarea { -webkit-tap-highlight-color: transparent; }
.ofw button { touch-action: manipulation; }
.ofw-toggle, .ofw-panel { pointer-events: auto; }
.ofw-toggle {
	position: absolute;
	right: 0;
	bottom: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	min-width: 158px;
	min-height: 48px;
	padding: 0 26px;
	border: 0;
	background: var(--ofw-panel-hi);
	clip-path: polygon(13px 0, 100% 0, calc(100% - 13px) 100%, 0 100%);
	font-weight: 700;
	letter-spacing: .16em;
	text-transform: uppercase;
	cursor: pointer;
}
.ofw-toggle::before {
	content: "";
	position: absolute;
	inset: 0 auto 0 9px;
	width: 4px;
	background: var(--ofw-cyan);
	transform: skewX(-15deg);
}
.ofw-toggle:hover, .ofw-toggle:focus-visible { background: var(--ofw-line); }
.ofw-toggle[aria-expanded="true"] { color: var(--ofw-cyan); }
.ofw-badge {
	display: grid;
	place-items: center;
	min-width: 25px;
	height: 25px;
	padding: 0 6px;
	background: var(--ofw-coral);
	color: #28060a;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0;
	clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%);
}
.ofw-panel {
	position: absolute;
	right: 0;
	bottom: 58px;
	display: flex;
	flex-direction: column;
	width: 100%;
	height: min(680px, calc(100dvh - 132px));
	min-height: 360px;
	overflow: hidden;
	background: var(--ofw-panel);
	border-left: 5px solid var(--ofw-cyan);
	box-shadow: 0 24px 80px rgba(0, 0, 0, .65);
}
.ofw-header {
	display: flex;
	align-items: center;
	gap: 16px;
	flex: none;
	min-height: 76px;
	padding: 14px 18px 12px 26px;
	background: var(--ofw-bg);
	border-bottom: 1px solid var(--ofw-line);
}
.ofw-heading { flex: 1; min-width: 0; }
.ofw-eyebrow, .ofw-section-title, .ofw-label {
	color: var(--ofw-faint);
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .2em;
	text-transform: uppercase;
}
.ofw-eyebrow { color: var(--ofw-magenta); }
.ofw-title { margin: 2px 0 0; font-size: 26px; line-height: 1.15; }
.ofw-button {
	position: relative;
	min-height: 40px;
	padding: 9px 18px;
	border: 0;
	border-left: 3px solid var(--ofw-line);
	background: var(--ofw-panel-hi);
	color: var(--ofw-text);
	font-size: 12px;
	font-weight: 700;
	line-height: 1.25;
	letter-spacing: .08em;
	text-transform: uppercase;
	cursor: pointer;
}
.ofw-button:hover, .ofw-button:focus-visible { border-left-color: var(--ofw-cyan); background: var(--ofw-line); }
.ofw-button:focus-visible, .ofw-toggle:focus-visible, .ofw-input:focus-visible, .ofw-log:focus-visible {
	outline: 2px solid var(--ofw-cyan);
	outline-offset: 2px;
}
.ofw-button:disabled { opacity: .48; cursor: default; }
.ofw-button.ofw-primary { background: var(--ofw-cyan); border-left-color: var(--ofw-cyan); color: #08201e; }
.ofw-button.ofw-primary:hover, .ofw-button.ofw-primary:focus-visible { background: #78ffec; }
.ofw-button.ofw-danger { background: var(--ofw-coral); border-left-color: var(--ofw-coral); color: #28060a; }
.ofw-close { flex: none; min-width: 74px; }
.ofw-status {
	flex: none;
	margin: 10px 16px 0;
	padding: 10px 14px;
	background: #0f2c34;
	border-left: 4px solid var(--ofw-cyan);
	color: var(--ofw-text);
}
.ofw-status.ofw-error { background: #3c101a; border-left-color: var(--ofw-coral); color: #ffc8be; }
.ofw-body { display: grid; grid-template-columns: minmax(300px, .9fr) minmax(340px, 1.1fr); flex: 1; min-height: 0; }
.ofw-directory { min-width: 0; overflow-y: auto; overscroll-behavior: contain; padding: 18px; border-right: 1px solid var(--ofw-line); }
.ofw-search { margin-bottom: 20px; }
.ofw-label { display: block; margin-bottom: 7px; }
.ofw-search-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
.ofw-input {
	width: 100%;
	min-width: 0;
	min-height: 44px;
	padding: 10px 12px;
	border: 0;
	border-bottom: 3px solid var(--ofw-cyan);
	background: var(--ofw-bg);
	color: var(--ofw-text);
	caret-color: var(--ofw-cyan);
}
.ofw-input::placeholder { color: var(--ofw-faint); opacity: 1; }
.ofw-input:disabled { opacity: .6; }
.ofw-section { margin-top: 18px; }
.ofw-section-title { margin: 0 0 7px; }
.ofw-people { list-style: none; margin: 0; padding: 0; }
.ofw-person {
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
	padding: 11px 0;
	border-top: 1px solid var(--ofw-line);
}
.ofw-avatar {
	display: grid;
	place-items: center;
	flex: none;
	width: 36px;
	height: 36px;
	background: var(--ofw-panel-hi);
	border-left: 3px solid var(--ofw-cyan);
	color: var(--ofw-cyan);
	font-size: 18px;
	font-weight: 700;
	clip-path: polygon(5px 0, 100% 0, calc(100% - 5px) 100%, 0 100%);
}
.ofw-who { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.ofw-name { font-size: 16px; font-weight: 500; overflow-wrap: anywhere; }
.ofw-meta { color: var(--ofw-dim); font-size: 12px; }
.ofw-person-actions { display: flex; flex: none; flex-wrap: wrap; justify-content: flex-end; gap: 7px; max-width: 55%; }
.ofw-person-actions .ofw-button { min-height: 36px; padding: 7px 11px; font-size: 10px; }
.ofw-empty { margin: 0; padding: 12px 0; color: var(--ofw-dim); list-style: none; }
.ofw-note { margin: 22px 0 4px; color: var(--ofw-faint); font-size: 12px; }
.ofw-chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--ofw-bg); }
.ofw-chat-header { display: flex; align-items: center; gap: 12px; flex: none; min-height: 58px; padding: 9px 14px; border-bottom: 1px solid var(--ofw-line); }
.ofw-chat-title { flex: 1; min-width: 0; margin: 0; font-size: 19px; overflow-wrap: anywhere; }
.ofw-back { display: none; }
.ofw-chat-empty { margin: auto; max-width: 280px; padding: 28px; color: var(--ofw-dim); text-align: center; }
.ofw-chat-content { display: flex; flex: 1; flex-direction: column; min-height: 0; padding: 12px 14px 14px; }
.ofw-earlier { align-self: center; flex: none; min-height: 34px; margin-bottom: 8px; padding-block: 6px; }
.ofw-log {
	flex: 1;
	min-height: 120px;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 12px;
	border-left: 2px solid var(--ofw-line);
	background: var(--ofw-panel);
	scrollbar-color: var(--ofw-line) var(--ofw-panel);
}
.ofw-message {
	width: fit-content;
	max-width: 88%;
	margin: 0 0 12px;
	padding: 9px 12px 10px;
	background: var(--ofw-panel-hi);
	border-left: 4px solid var(--ofw-magenta);
}
.ofw-message.ofw-mine { margin-left: auto; border-left: 0; border-right: 4px solid var(--ofw-cyan); }
.ofw-message-meta { margin-bottom: 4px; color: var(--ofw-faint); font-size: 10px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.ofw-message-text { color: var(--ofw-text); font-size: 15px; line-height: 1.42; white-space: pre-wrap; overflow-wrap: anywhere; }
.ofw-compose { flex: none; margin-top: 12px; }
.ofw-compose-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 10px; }
.ofw-draft { display: block; min-height: 52px; max-height: 120px; resize: vertical; line-height: 1.35; }
.ofw-send { min-height: 52px; min-width: 82px; }

/* Friend matches: the play button on online friends, the row's invite state, incoming invite plates. */
.ofw-button.ofw-match { background: var(--ofw-magenta); border-left-color: var(--ofw-magenta); color: #250828; }
.ofw-button.ofw-match:hover, .ofw-button.ofw-match:focus-visible { background: #f79bff; }
.ofw-match-state { color: var(--ofw-cyan); font-weight: 700; letter-spacing: .02em; }
.ofw-match-state.ofw-match-bad { color: var(--ofw-coral); }
.ofw-countdown { font-variant-numeric: tabular-nums; }
.ofw-match-box { display: grid; flex: none; gap: 8px; margin: 10px 16px 0; pointer-events: auto; }
.ofw-match-box.ofw-match-floating { position: absolute; right: 0; bottom: 58px; width: min(460px, 100%); margin: 0; }
.ofw-match-plate {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	align-items: center;
	gap: 8px 14px;
	padding: 12px 22px 12px 16px;
	background: var(--ofw-panel-hi);
	border-left: 5px solid var(--ofw-magenta);
	clip-path: polygon(0 0, 100% 0, calc(100% - 14px) 100%, 0 100%);
}
.ofw-match-floating .ofw-match-plate { background: var(--ofw-panel); box-shadow: inset 0 0 0 1px var(--ofw-line); }
.ofw-match-text { margin: 0; font-size: 15px; line-height: 1.35; overflow-wrap: anywhere; }
.ofw-match-from { color: var(--ofw-magenta); font-weight: 700; }
.ofw-match-time { color: var(--ofw-cyan); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.ofw-match-time-label { color: var(--ofw-faint); font-weight: 700; }
.ofw-match-actions { display: flex; grid-column: 1 / -1; gap: 8px; }
.ofw-match-actions .ofw-button { flex: 1; min-height: 44px; }

/* Mode / Map on the play button, and the friend menu (right-click, touch hold, context-menu key, More). */
.ofw-button.ofw-match { text-align: left; }
.ofw-match-choice { display: block; margin-top: 2px; font-size: 9px; font-weight: 700; letter-spacing: .06em; opacity: .82; }
.ofw-person[data-friend] { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.ofw-menu {
	position: fixed;
	left: 8px;
	top: 8px;
	z-index: 40;
	display: flex;
	flex-direction: column;
	width: min(340px, calc(100vw - 16px));
	max-height: calc(100dvh - 16px);
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 0 0 8px;
	background: var(--ofw-bg);
	border-left: 5px solid var(--ofw-magenta);
	box-shadow: 0 0 0 1px var(--ofw-line), 0 18px 60px rgba(0, 0, 0, .7);
	pointer-events: auto;
}
.ofw-menu-head { display: flex; align-items: baseline; gap: 10px; padding: 12px 16px 10px; background: var(--ofw-panel); border-bottom: 1px solid var(--ofw-line); }
.ofw-menu-name { flex: 1; min-width: 0; font-size: 16px; font-weight: 700; overflow-wrap: anywhere; }
.ofw-menu-state { flex: none; color: var(--ofw-dim); font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.ofw-menu-title { margin: 12px 16px 2px; color: var(--ofw-magenta); font-size: 11px; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; }
.ofw-menu-group { margin: 12px 16px 0; }
.ofw-menu-label { display: block; margin-bottom: 5px; color: var(--ofw-dim); font-size: 10px; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; }
.ofw-menu-options { display: flex; flex-wrap: wrap; gap: 6px; }
.ofw .ofw-menu-item {
	display: block;
	width: calc(100% - 16px);
	min-height: 40px;
	margin: 0 8px;
	padding: 9px 12px;
	border: 0;
	border-left: 3px solid transparent;
	background: transparent;
	color: var(--ofw-text);
	font-size: 12px;
	font-weight: 700;
	line-height: 1.25;
	letter-spacing: .08em;
	text-align: left;
	text-transform: uppercase;
	cursor: pointer;
}
.ofw .ofw-menu-item:hover, .ofw .ofw-menu-item:focus-visible { border-left-color: var(--ofw-cyan); background: var(--ofw-panel-hi); }
.ofw .ofw-menu-item:focus-visible { outline: 2px solid var(--ofw-cyan); outline-offset: -2px; }
.ofw .ofw-menu-item[aria-disabled="true"] { color: var(--ofw-faint); cursor: default; }
.ofw .ofw-menu-item[aria-disabled="true"]:hover { border-left-color: transparent; background: transparent; }
.ofw .ofw-menu-options .ofw-menu-item {
	width: auto;
	min-height: 36px;
	margin: 0;
	padding: 7px 12px 7px 10px;
	border-left: 3px solid var(--ofw-line);
	background: var(--ofw-panel-hi);
	font-size: 11px;
	clip-path: polygon(0 0, 100% 0, calc(100% - 7px) 100%, 0 100%);
}
.ofw .ofw-menu-options .ofw-menu-item[aria-checked="true"] { border-left-color: var(--ofw-cyan); background: var(--ofw-cyan); color: #08201e; }
.ofw .ofw-menu-options .ofw-menu-item[aria-disabled="true"] { background: var(--ofw-panel); color: var(--ofw-faint); }
.ofw-menu-note { display: block; margin-top: 2px; font-size: 9px; font-weight: 500; letter-spacing: .04em; text-transform: none; }
.ofw .ofw-menu-item.ofw-menu-invite {
	width: calc(100% - 32px);
	min-height: 44px;
	margin: 12px 16px 0;
	padding-right: 22px;
	border-left-color: var(--ofw-magenta);
	background: var(--ofw-magenta);
	color: #250828;
	clip-path: polygon(0 0, 100% 0, calc(100% - 12px) 100%, 0 100%);
}
.ofw .ofw-menu-item.ofw-menu-invite:hover, .ofw .ofw-menu-item.ofw-menu-invite:focus-visible { background: #f79bff; }
.ofw .ofw-menu-item.ofw-menu-invite[aria-disabled="true"],
.ofw .ofw-menu-item.ofw-menu-invite[aria-disabled="true"]:hover { border-left-color: var(--ofw-line); background: var(--ofw-panel-hi); color: var(--ofw-faint); }
.ofw-menu-reason { margin: 6px 16px 0; color: var(--ofw-coral); font-size: 12px; line-height: 1.35; }
.ofw-menu-rule { height: 1px; margin: 12px 0 6px; background: var(--ofw-line); }
.ofw .ofw-menu-item.ofw-menu-danger { border-left-color: var(--ofw-coral); background: var(--ofw-coral); color: #28060a; }

/* A narrow widget becomes one view at a time; the Friends back button preserves the cached chat. */
@media (max-width: 700px) {
	.ofw {
		right: max(10px, env(safe-area-inset-right));
		bottom: calc(10px + env(safe-area-inset-bottom));
		width: calc(100vw - max(20px, env(safe-area-inset-left) + env(safe-area-inset-right)));
	}
	.ofw-panel {
		position: fixed;
		inset: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
		width: auto;
		height: auto;
		min-height: 0;
	}
	.ofw-header { min-height: 64px; padding: 10px 12px 9px 18px; }
	.ofw-title { font-size: 22px; }
	.ofw-body { display: block; overflow: hidden; }
	.ofw-directory { height: 100%; padding: 14px; border-right: 0; }
	.ofw-chat { display: none; height: 100%; }
	.ofw-chat-open .ofw-directory { display: none; }
	.ofw-chat-open .ofw-chat { display: flex; }
	.ofw-chat-open .ofw-back { display: block; }
	.ofw-chat-content { padding: 9px 10px 10px; }
	.ofw-person { flex-wrap: wrap; }
	.ofw-person-actions { flex: 1 0 calc(100% - 46px); justify-content: flex-start; max-width: none; margin-left: 46px; }
	.ofw-person-actions .ofw-button { min-height: 44px; padding-inline: 15px; }
	.ofw-search-row { grid-template-columns: 1fr; }
	.ofw-search-row .ofw-button { min-height: 44px; }
	.ofw-compose-row { grid-template-columns: minmax(0, 1fr) 76px; }
	.ofw-send { min-width: 0; padding-inline: 10px; }
	.ofw-message { max-width: 94%; }
	.ofw-match-box { margin: 8px 10px 0; }
	.ofw-match-box.ofw-match-floating { width: 100%; }
	.ofw-match-plate { grid-template-columns: 1fr; padding-right: 18px; }
	.ofw .ofw-menu-item { min-height: 44px; }
	.ofw .ofw-menu-options .ofw-menu-item { min-height: 44px; padding-block: 9px; }
}
@media (max-width: 380px) {
	.ofw-compose-row { grid-template-columns: 1fr; }
	.ofw-send { width: 100%; min-height: 44px; }
}
@media (prefers-reduced-motion: no-preference) {
	.ofw-panel { animation: ofw-in 120ms ease-out; }
	@keyframes ofw-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
}
