/* CPC shared chat dock (Phase 1) - see assets/js/cpc-chat.js.
   The dock lives inside a player stage (position: relative). Hosts can move
   the launcher with --cpc-chat-launch-top / --cpc-chat-accent. */

.cpc-chat {
	--cpc-chat-accent: #d4a84b;
	--cpc-chat-glass: rgba( 12, 12, 16, 0.72 );
	--cpc-chat-border: rgba( 255, 255, 255, 0.12 );
	position: absolute;
	inset: 0;
	z-index: 16;
	pointer-events: none;
	font: 14px/1.35 system-ui, -apple-system, "Segoe UI", sans-serif;
	color: #fff;
}

.cpc-chat__launch {
	position: absolute;
	top: var( --cpc-chat-launch-top, 52px );
	left: 50%;
	transform: translateX( -50% );
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 12px;
	border: 1px solid var( --cpc-chat-border );
	border-radius: 999px;
	background: var( --cpc-chat-glass );
	-webkit-backdrop-filter: blur( 10px );
	backdrop-filter: blur( 10px );
	color: #fff;
	font: inherit;
	font-size: 12px;
	font-weight: 600;
	cursor: pointer;
	pointer-events: auto;
}
.cpc-chat__launch:hover,
.cpc-chat__launch:focus-visible { border-color: var( --cpc-chat-accent ); outline: none; }
.cpc-chat__launch-count:not(:empty)::before { content: "\00b7\00a0"; opacity: 0.7; }
.cpc-chat__dot {
	display: none;
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var( --cpc-chat-accent );
}
.cpc-chat.has-unread .cpc-chat__dot { display: inline-block; }
.cpc-chat.is-open .cpc-chat__launch { display: none; }

.cpc-chat__panel {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: min( 46%, 440px );
	display: flex;
	flex-direction: column;
	border-top: 1px solid var( --cpc-chat-border );
	border-radius: 18px 18px 0 0;
	background: var( --cpc-chat-glass );
	-webkit-backdrop-filter: blur( 14px );
	backdrop-filter: blur( 14px );
	pointer-events: auto;
	padding-bottom: env( safe-area-inset-bottom, 0px );
	animation: cpc-chat-up 0.22s ease-out;
}
.cpc-chat__panel[hidden] { display: none; }
@keyframes cpc-chat-up { from { transform: translateY( 24px ); opacity: 0; } to { transform: none; opacity: 1; } }

.cpc-chat__head {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 12px 6px;
}
.cpc-chat__tabs { display: flex; gap: 4px; }
.cpc-chat__tab {
	padding: 5px 12px;
	border: 1px solid transparent;
	border-radius: 999px;
	background: transparent;
	color: rgba( 255, 255, 255, 0.72 );
	font: inherit;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
}
.cpc-chat__tab[aria-selected="true"] {
	border-color: var( --cpc-chat-border );
	background: rgba( 255, 255, 255, 0.1 );
	color: #fff;
}
.cpc-chat__tab:disabled { opacity: 0.4; cursor: default; }
.cpc-chat__online { margin-left: auto; font-size: 12px; opacity: 0.7; }
.cpc-chat__online:not(:empty)::before {
	content: "";
	display: inline-block;
	width: 7px;
	height: 7px;
	margin-right: 5px;
	border-radius: 50%;
	background: #3ddc84;
	vertical-align: 1px;
}
.cpc-chat__close {
	width: 30px;
	height: 30px;
	border: 0;
	border-radius: 50%;
	background: rgba( 255, 255, 255, 0.08 );
	color: #fff;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
}

.cpc-chat__list {
	flex: 1;
	margin: 0;
	padding: 4px 12px;
	overflow-y: auto;
	overscroll-behavior: contain;
	list-style: none;
}
.cpc-chat__msg {
	display: flex;
	gap: 8px;
	margin: 6px 0;
	animation: cpc-chat-in 0.25s ease-out;
}
@keyframes cpc-chat-in { from { opacity: 0; transform: translateY( 6px ); } to { opacity: 1; transform: none; } }
.cpc-chat__avatar { width: 26px; height: 26px; border-radius: 50%; flex: none; }
.cpc-chat__bubble { min-width: 0; }
.cpc-chat__meta { display: flex; gap: 6px; align-items: baseline; font-size: 12px; }
.cpc-chat__name { font-weight: 700; }
.cpc-chat__msg.is-mine .cpc-chat__name { color: var( --cpc-chat-accent ); }
.cpc-chat__msg.is-bot .cpc-chat__name::after { content: " \2022 bot"; font-weight: 400; opacity: 0.7; }
.cpc-chat__time { opacity: 0.55; }
.cpc-chat__held { color: #ffb347; }
.cpc-chat__body {
	margin: 1px 0 0;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
}
.cpc-chat__msg.is-held .cpc-chat__body { opacity: 0.6; }
.cpc-chat__remove {
	margin-top: 2px;
	padding: 0;
	border: 0;
	background: none;
	color: rgba( 255, 255, 255, 0.5 );
	font-size: 11px;
	cursor: pointer;
}
.cpc-chat__remove:hover { color: #fff; }
.cpc-chat__empty { margin: 0; padding: 4px 12px; font-size: 13px; opacity: 0.6; }
.cpc-chat__empty[hidden] { display: none; }

.cpc-chat__form {
	display: flex;
	gap: 8px;
	padding: 8px 12px 12px;
}
.cpc-chat__form[hidden] { display: none; }
.cpc-chat__input {
	flex: 1;
	min-width: 0;
	height: 40px;
	padding: 0 14px;
	border: 1px solid var( --cpc-chat-border );
	border-radius: 999px;
	background: rgba( 255, 255, 255, 0.08 );
	color: #fff;
	font: inherit;
	font-size: 16px; /* 16px stops iOS zooming the page on focus */
}
.cpc-chat__input:focus { outline: none; border-color: var( --cpc-chat-accent ); }
.cpc-chat__send {
	height: 40px;
	padding: 0 16px;
	border: 0;
	border-radius: 999px;
	background: var( --cpc-chat-accent );
	color: #111;
	font: inherit;
	font-weight: 700;
	cursor: pointer;
}
.cpc-chat__send:disabled { opacity: 0.6; }
.cpc-chat__login {
	display: block;
	margin: 8px 12px 12px;
	padding: 10px;
	border-radius: 999px;
	background: rgba( 255, 255, 255, 0.1 );
	color: #fff;
	text-align: center;
	text-decoration: none;
	font-weight: 600;
}
.cpc-chat__login[hidden] { display: none; }
.cpc-chat__note { margin: 0 12px 8px; color: #ffb347; font-size: 12px; }

@media ( prefers-reduced-motion: reduce ) {
	.cpc-chat__panel,
	.cpc-chat__msg { animation: none; }
}

/* DJ tab (Phase 2) */
.cpc-chat__tab--dj[hidden] { display: none; }
.cpc-chat__tab--dj::before { content: "\266B\00a0"; color: var( --cpc-chat-accent ); }
.cpc-chat__picker {
	max-width: 9rem;
	height: 28px;
	border: 1px solid var( --cpc-chat-border );
	border-radius: 999px;
	background: rgba( 255, 255, 255, 0.08 );
	color: #fff;
	font: inherit;
	font-size: 12px;
}
.cpc-chat__picker[hidden] { display: none; }
.cpc-chat__picker option { color: #111; }
.cpc-chat__msg.is-bot .cpc-chat__name { color: var( --cpc-chat-accent ); }
.cpc-chat__msg.is-bot .cpc-chat__avatar { box-shadow: 0 0 0 2px var( --cpc-chat-accent ); }
.cpc-chat__typing {
	margin: 0;
	padding: 0 12px 4px;
	font-size: 12px;
	font-style: italic;
	opacity: 0.75;
}
.cpc-chat__typing[hidden] { display: none; }
