/* ============================================== */
/* ECHO :: global broadcast — old-internet vibes  */
/* ============================================== */

* { box-sizing: border-box; }

html, body {
	margin: 0;
	padding: 0;
	height: 100%;
	overflow: hidden;
}

body {
	font-family: 'Comic Neue', 'Comic Sans MS', cursive, sans-serif;
	color: #fff;
	background:
		radial-gradient(circle at 20% 10%, rgba(255, 0, 255, 0.35), transparent 40%),
		radial-gradient(circle at 80% 80%, rgba(0, 255, 255, 0.30), transparent 45%),
		linear-gradient(160deg, #0b003a 0%, #2a006e 45%, #4b0082 100%);
	background-attachment: fixed;
	height: 100vh;
	position: relative;
}

/* tiled starfield overlay */
.stars {
	position: fixed;
	inset: 0;
	pointer-events: none;
	z-index: 0;
	background-image:
		radial-gradient(1px 1px at 12px 18px, #fff, transparent),
		radial-gradient(1px 1px at 64px 90px, #fff, transparent),
		radial-gradient(2px 2px at 130px 30px, #ffeb6e, transparent),
		radial-gradient(1px 1px at 180px 130px, #fff, transparent),
		radial-gradient(1px 1px at 220px 60px, #b0e8ff, transparent),
		radial-gradient(1px 1px at 50px 200px, #fff, transparent);
	background-size: 240px 240px;
	opacity: 0.7;
	animation: stars-drift 60s linear infinite;
}

@keyframes stars-drift {
	from { background-position: 0 0; }
	to   { background-position: 240px 480px; }
}

/* ---------- top marquee ---------- */
.topbar {
	position: fixed;
	top: 0; left: 0; right: 0;
	z-index: 5;
	background: repeating-linear-gradient(
		45deg,
		#9900ff 0 12px,
		#000 12px 24px
	);
	border-bottom: 4px ridge #520072;
	padding: 4px 0;
}

.topbar-marquee {
	font-family: 'VT323', monospace;
	font-size: 22px;
	color: #ffffff;
	text-shadow: 2px 2px 0 #ff00ea, 0 0 8px #ad66ff;
	letter-spacing: 1px;
}

/* ---------- masthead with ON AIR ---------- */
.masthead {
	position: fixed;
	top: 38px; left: 0; right: 0;
	z-index: 4;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 8px 22px;
	pointer-events: none;
}

.logo {
	font-family: 'Press Start 2P', 'Impact', sans-serif;
	font-size: 56px;
	margin: 0;
	letter-spacing: 6px;
	line-height: 1;
}

.logo-front {
	background: linear-gradient(180deg, #fff 0%, #d466ff 35%, #8f66ff 70%, #3f12bb 100%);
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
	text-shadow: 0 0 1px rgba(255,255,255,0.5);
	animation: chrome-shine 3s ease-in-out infinite alternate;
}

@keyframes chrome-shine {
	0%   { filter: hue-rotate(0deg)  drop-shadow(0 0 6px #ff66cc); }
	100% { filter: hue-rotate(40deg) drop-shadow(0 0 14px #00e5ff); }
}

.onair-row {
	display: flex;
	align-items: center;
	gap: 12px;
}

.onair-badge {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 4px 12px;
	background: #000;
	color: #ff3355;
	font-family: 'VT323', monospace;
	font-size: 22px;
	letter-spacing: 3px;
	border: 2px ridge #ff3355;
	text-shadow: 0 0 6px #ff3355;
}

.onair-dot {
	width: 12px;
	height: 12px;
	background: #ff3355;
	border-radius: 50%;
	box-shadow: 0 0 10px #ff3355;
	animation: blink 0.9s steps(2, end) infinite;
}

.onair-count {
	display: inline-flex;
	align-items: baseline;
	gap: 8px;
	background: #000;
	border: 2px ridge #00ff66;
	padding: 4px 12px;
}

.onair-count .hitcounter-label {
	font-family: 'VT323', monospace;
	color: #fff;
	font-size: 16px;
}
.onair-count .hitcounter-digits {
	font-family: 'VT323', monospace;
	font-size: 22px;
	color: #00ff66;
	letter-spacing: 3px;
	text-shadow: 0 0 6px #00ff66;
}

/* ---------- broadcast canvas (full viewport) ---------- */
.broadcast-canvas {
	position: fixed;
	inset: 0;
	z-index: 1;
	pointer-events: none;
	overflow: hidden;
}

.msg-slot {
	position: absolute;
	pointer-events: none;
	transform: translate(-50%, -50%) rotate(var(--slot-rot, 0deg));
	translate: 0 0;
	animation: slot-drift 2.05s ease-out both;
}

@keyframes slot-drift {
	from { translate: 0 0; }
	to   { translate: var(--drift-x, 0px) var(--drift-y, -24px); }
}

/* ---------- panels (Win98-ish) ---------- */
.panel {
	background: linear-gradient(180deg, #d4d0c8 0%, #ece9d8 100%);
	color: #000;
	border: 2px outset #ffffff;
	border-radius: 0;
	padding: 8px 12px 12px;
	box-shadow: 4px 4px 0 #000;
	margin: 0;
}

.panel > legend {
	font-family: 'VT323', monospace;
	font-size: 18px;
	background: #000080;
	color: #fff;
	padding: 0;
	border: 2px outset #fff;
	letter-spacing: 1px;
}

/* ---------- floating settings panel ---------- */
.settings-panel {
	position: fixed;
	top: 130px;
	right: 16px;
	width: 300px;
	z-index: 6;
	pointer-events: auto;
}

.settings-panel.is-collapsed > .settings-body { display: none; }

.settings-legend {
	cursor: pointer;
}

.settings-toggle {
	font: inherit;
	background: transparent;
	border: 0;
	color: inherit;
	cursor: pointer;
	padding: 2px 10px;
	letter-spacing: 1px;
	font-family: 'VT323', monospace;
	font-size: 18px;
}

/* ---------- form fields ---------- */
.field {
	display: block;
	margin: 8px 0;
}

.field-label {
	display: block;
	font-family: 'VT323', monospace;
	font-size: 16px;
	color: #000080;
	margin-bottom: 4px;
	letter-spacing: 1px;
}

#username, #style-css, #input {
	width: 100%;
	font-family: 'Courier New', monospace;
	font-size: 14px;
	color: #000;
	background: #fff;
	border: 2px inset #c0c0c0;
	padding: 5px 7px;
}

#style-css {
	resize: vertical;
	min-height: 80px;
	line-height: 1.35;
}

#username:focus, #style-css:focus, #input:focus {
	outline: 2px dotted #000080;
	outline-offset: -4px;
}

/* ---------- preset buttons ---------- */
.preset-list {
	display: flex;
	flex-wrap: wrap;
	gap: 5px;
}

.preset-btn {
	font-family: 'Comic Neue', 'Comic Sans MS', cursive;
	font-size: 12px;
	font-weight: 700;
	padding: 4px 22px 4px 9px;
	background: linear-gradient(180deg, #ffffff, #d4d0c8 60%, #a8a4a0);
	color: #000;
	border: 2px outset #fff;
	cursor: pointer;
	letter-spacing: 0.5px;
	position: relative;
}

.preset-btn:hover { filter: brightness(1.1); }
.preset-btn:active { border-style: inset; }
.preset-btn.is-active {
	background: linear-gradient(180deg, #ffe066, #ff8800);
	border-style: inset;
}

.preset-del {
	position: absolute;
	top: 1px;
	right: 3px;
	font-family: 'VT323', monospace;
	font-size: 13px;
	line-height: 1;
	padding: 1px 3px;
	color: #aa0000;
	background: transparent;
	border: 0;
	cursor: pointer;
}
.preset-del:hover {
	color: #fff;
	background: #cc0000;
}

/* save-preset row */
.save-preset {
	display: flex;
	gap: 5px;
	margin-top: 6px;
}

.save-preset input {
	flex: 1;
	min-width: 0;
	font-family: 'Courier New', monospace;
	font-size: 12px;
	color: #000;
	background: #fff;
	border: 2px inset #c0c0c0;
	padding: 3px 6px;
}

.save-preset input:focus {
	outline: 2px dotted #000080;
	outline-offset: -4px;
}

.save-btn { white-space: nowrap; }

.save-preset-error {
	min-height: 14px;
	margin-top: 3px;
	font-family: 'VT323', monospace;
	font-size: 13px;
	color: #cc0000;
	letter-spacing: 0.5px;
}

.preset-empty {
	font-family: 'VT323', monospace;
	font-size: 14px;
	color: #555;
	font-style: italic;
}

/* ---------- preview ---------- */
.preview-stage {
	background:
		repeating-linear-gradient(45deg, #c0c0c0 0 6px, #a0a0a0 6px 12px);
	border: 2px inset #fff;
	padding: 12px;
	min-height: 60px;
	display: flex;
	align-items: center;
	justify-content: center;
}

/* ---------- status pill ---------- */
.status {
	display: inline-block;
	font-family: 'VT323', monospace;
	font-size: 14px;
	background: #000;
	color: #00ff66;
	padding: 2px 8px;
	border: 1px solid #00ff66;
	white-space: nowrap;
}

.status.is-disconnected {
	color: #ff3355;
	border-color: #ff3355;
	animation: blink 0.9s steps(2, end) infinite;
}

@keyframes blink {
	50% { opacity: 0.25; }
}

/* ---------- messages (default look — overridden by user CSS) ---------- */
.msg {
	display: inline-block;
	max-width: 40ch;
	margin: 0;
	padding: 8px 12px;
	font-family: 'Comic Neue', 'Comic Sans MS', cursive;
	font-size: 16px;
	color: #000;
	background: #fff;
	border: 2px ridge #ff66cc;
	border-radius: 14px;
	box-shadow: 3px 3px 0 rgba(0,0,0,0.25);
	word-break: break-word;
	white-space: pre-wrap;
	animation:
		msg-in 0.45s cubic-bezier(.2,1.4,.4,1) both,
		msg-out 0.5s ease-in 1.5s forwards;
}

.msg-name {
	display: inline-block;
	font-weight: 700;
	margin-right: 6px;
	opacity: 0.85;
}
.msg-name::after { content: ":"; }

.msg-text { display: inline; }

@keyframes msg-in {
	0%   { transform: translateX(-40px) scale(0.6) rotate(-6deg); opacity: 0; filter: blur(6px); }
	60%  { transform: translateX(4px)  scale(1.06) rotate(2deg);  opacity: 1; filter: blur(0); }
	100% { transform: translateX(0)    scale(1)    rotate(0);     opacity: 1; }
}

@keyframes msg-out {
	0%   { opacity: 1; transform: translateY(0)    scale(1); }
	100% { opacity: 0; transform: translateY(-30px) scale(0.9); filter: blur(4px); }
}

/* shared keyframes that presets reference */
@keyframes rainbow-text {
	0%   { color: #ff0000; }
	16%  { color: #ff9900; }
	33%  { color: #ffee00; }
	50%  { color: #33ff33; }
	66%  { color: #33ccff; }
	83%  { color: #cc66ff; }
	100% { color: #ff0099; }
}

@keyframes preset-blink {
	50% { visibility: hidden; }
}

@keyframes preset-glow {
	0%, 100% { box-shadow: 0 0 6px #ff66cc, 0 0 14px #ff66cc; }
	50%      { box-shadow: 0 0 14px #00e5ff, 0 0 28px #00e5ff; }
}

@keyframes preset-flicker {
	0%, 100% { text-shadow: 0 0 4px #ffaa00, 0 0 10px #ff3300; }
	50%      { text-shadow: 0 0 10px #ffee00, 0 0 22px #ff6600; }
}

/* ---------- bottom dock (badges + compose bar) ---------- */
.bottom-dock {
	position: fixed;
	bottom: 0; left: 0; right: 0;
	z-index: 7;
	pointer-events: none;
}

.dock-meta {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 4px 16px 6px;
	flex-wrap: wrap;
	pointer-events: auto;
}

.dock-copy {
	font-family: 'VT323', monospace;
	font-size: 13px;
	color: #ffe066;
	text-shadow: 1px 1px 0 #000;
}

.compose-bar {
	display: flex;
	justify-content: center;
	align-items: center;
	padding: 4px 16px 14px;
	background: linear-gradient(180deg, transparent, rgba(0,0,0,0.55));
	pointer-events: auto;
}

.compose-frame {
	flex: 1;
	max-width: 820px;
	display: flex;
	align-items: center;
	gap: 10px;
	background: linear-gradient(180deg, #d4d0c8 0%, #ece9d8 100%);
	border: 2px outset #fff;
	box-shadow: 3px 3px 0 #000;
	padding: 6px 10px;
}

.compose-frame #input {
	flex: 1;
}

.transmit-label {
	font-family: 'VT323', monospace;
	font-size: 16px;
	color: #aa0000;
	letter-spacing: 1px;
	white-space: nowrap;
	text-shadow: 0 0 2px #ff3355;
}

.enter-hint {
	font-family: 'VT323', monospace;
	font-size: 14px;
	color: #000080;
	white-space: nowrap;
}

/* ---------- badges ---------- */
.badge {
	font-family: 'VT323', monospace;
	font-size: 13px;
	padding: 2px 8px;
	border: 2px outset #fff;
	background: #c0c0c0;
	color: #000;
	text-shadow: none;
}

.badge-ie         { background: linear-gradient(180deg, #fff, #99ccff); }
.badge-construction {
	background: repeating-linear-gradient(45deg, #ffee00 0 8px, #000 8px 16px);
	color: #fff;
	text-shadow: 1px 1px 0 #000;
}

.heart {
	color: #ff3366;
	display: inline-block;
	animation: heartbeat 1.2s ease-in-out infinite;
}

@keyframes heartbeat {
	0%, 100% { transform: scale(1); }
	30%      { transform: scale(1.3); }
	60%      { transform: scale(0.95); }
}

/* ---------- responsive ---------- */
@media (max-width: 760px) {
	.masthead {
		flex-direction: column;
		align-items: flex-start;
		gap: 8px;
		top: 34px;
		padding: 6px 12px;
	}
	.logo { font-size: 38px; letter-spacing: 4px; }
	.onair-badge, .onair-count { font-size: 16px; padding: 2px 8px; }
	.onair-count .hitcounter-digits { font-size: 18px; }

	.settings-panel {
		top: auto;
		bottom: 96px;
		right: 8px;
		left: 8px;
		width: auto;
		max-height: 60vh;
		overflow: auto;
	}

	.dock-copy { display: none; }
}
