* { box-sizing: border-box; }
html, body { height: 100%; }
body {
	margin: 0;
	background: #1a1a1a;
	font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
	color: #eee;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

/* ----- Canvas (stretched to fill available height) ----- */
#demo {
	position: relative;
	flex: 1 1 auto;
	width: 100%;
	background: #000;
	overflow: hidden;
}
canvas { position: absolute; }
#canvas { background: #000; }

/* Icons above the canvas (right side, vertical) */
#canvas-icons {
	position: absolute;
	top: 12px;
	right: 12px;
	z-index: 10;            /* above the canvas */
	display: flex;
	flex-direction: column;
	gap: 10px;
}
/* Icons above the canvas (left side, vertical) — VU toggle */
#canvas-icons-left {
	position: absolute;
	top: 12px;
	left: 12px;
	z-index: 10;
	display: flex;
	flex-direction: column;
	gap: 10px;
}
#canvas-icons .icon, #canvas-icons-left .icon {
	width: 30px;             /* render a 128x128 viewBox, show 30px */
	height: 30px;
	color: #fff;
	opacity: 0.22;            /* heavily dimmed */
	cursor: pointer;
	transition: opacity 0.15s;
}
#canvas-icons .icon:hover, #canvas-icons-left .icon:hover { opacity: 0.85; }

/* In fullscreen mode icons are nearly invisible, the player is hidden */
/* In fullscreen mode icons dim when idle, brighten on mouse activity. */
#demo.fullscreen #canvas-icons .icon, #demo.fullscreen #canvas-icons-left .icon { opacity: 0.9; transition: opacity 0.3s; }
#demo.fullscreen.idle #canvas-icons .icon, #demo.fullscreen.idle #canvas-icons-left .icon { opacity: 0.05; }
#demo.fullscreen.idle #canvas-icons .icon:hover, #demo.fullscreen.idle #canvas-icons-left .icon:hover { opacity: 0.5; }
#demo.fullscreen #player-bar { display: none; }

.icon-spacer { height: 14px; }

/* ----- Modal windows over the canvas ----- */
.modal {
	position: absolute;
	top: 60px;
	right: 12px;
	z-index: 20;            /* above the canvas and icons */
	width: 560px;            /* widened to fit 16 swatches in two rows */
	max-height: calc(100% - 72px);
	background: #232323;
	border: 1px solid #555;
	border-radius: 10px;
	box-shadow: 0 8px 40px rgba(0,0,0,0.6);
	display: none;
	overflow: hidden;
}
.modal-title {
	display: flex;
	align-items: center;
	justify-content: space-between;
	background: #2f2f2f;
	padding: 6px 12px;
	border-bottom: 1px solid #444;
	height: 30px;
}
.modal-title-text {
	color: #6cf;
	font-size: 12px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}
.modal-close {
	background: transparent;
	color: #aaa;
	border: none;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	padding: 0 4px;
}
.modal-close:hover { color: #fff; }
.modal-body {
	padding: 10px 12px;
	max-height: calc(100vh - 160px);
	overflow: auto;
}
/* Equalizer — full width, at the bottom edge of the canvas */
.modal-bottom {
	top: auto;
	bottom: 0;
	left: 0;
	right: 0;
	width: auto;
	max-height: 340px;
	border-radius: 10px 10px 0 0;
	background: rgba(35, 35, 35, 0.5);   /* semi-transparent panel background (content stays full-opacity) */
}
.modal-bottom .modal-title { background: rgba(47, 47, 47, 0.5); }
.modal-bottom .modal-body {
	max-height: none;       /* content determines its own height */
}
/* modal rows */
.type-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin: 6px 0;
	font-size: 13px;
	color: #eee;
}
/* Gain menu rows — grid: label | value | slider(1fr) | [Normalize] [checkbox] */
.gain-row {
	display: grid;
	grid-template-columns: auto auto 1fr auto auto;
	align-items: center;
	gap: 10px;
	margin: 6px 0;
	font-size: 13px;
	color: #eee;
}
.spectre-group {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}
.gain-row .val { min-width: 42px; text-align: right; }
.gain-row input[type=range] { width: 100%; min-width: 80px; }
.type-row input[type=checkbox], .gain-row input[type=checkbox] { margin: 0; }
#icon-about { margin-top: 60px; }   /* nudge down as if an icon were above it */

/* Visual modes block — a bordered group inside Settings */
#visual-modes-block, #bands-block, #colors-block {
	border: 1px dotted #888;
	border-radius: 8px;
	padding: 8px 10px 10px 10px;
	margin: 8px 0 12px 0;
}
.visual-modes-title {
	font-size: 12px;
	color: #aaa;
	margin-bottom: 6px;
	letter-spacing: 0.5px;
	text-transform: uppercase;
}
/* Each Visual mode row: hover highlight + pointer cursor */
#visual-modes-block .type-row {
	cursor: pointer;
	padding: 4px 6px;
	border-radius: 4px;
	transition: background 0.15s;
}
#visual-modes-block .type-row:hover {
	background: rgba(255, 255, 255, 0.10);
}

/* ----- Player bar (narrow, under the canvas) ----- */
#player-bar {
	display: flex;
	align-items: center;
	gap: 12px;
	background: #232323;
	padding: 8px 12px;
	border-top: 1px solid #444;
	border-bottom: 1px solid #444;
	flex: 0 0 auto;
}
.file-field {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 400px;
	flex: 0 0 400px;
	position: relative;
}
.nav-btn {
	background: #3a3a3a;
	color: #eee;
	border: 1px solid #555;
	border-radius: 6px;
	padding: 6px 8px;
	font-size: 13px;
	cursor: pointer;
	line-height: 1;
}
.nav-btn:hover { background: #4a4a4a; border-color: #6cf; }
#track-list {
	display: none;
	position: absolute;
	bottom: 100%;            /* open upward (above the player bar) */
	left: 0;
	margin-bottom: 4px;
	background: #2a2a2a;
	border: 1px solid #555;
	border-radius: 6px;
	padding: 4px;
	max-height: 240px;
	overflow: auto;
	z-index: 30;
	min-width: 260px;
	box-shadow: 0 -6px 18px rgba(0,0,0,0.5);
}
#track-list.open { display: block; }
#track-list .track-item {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 6px 8px;
	border-radius: 4px;
	cursor: pointer;
	color: #ddd;
	font-size: 13px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
#track-list .track-item:hover { background: rgba(255,255,255,0.10); }
#track-list .track-item.active { background: rgba(108,204,255,0.18); color: #fff; }
#track-list .track-item .track-idx { color: #888; min-width: 20px; text-align: right; }
#pick-track {
	background: #3a3a3a;
	color: #eee;
	border: 1px solid #555;
	border-radius: 6px;
	padding: 6px 14px;
	font-size: 13px;
	cursor: pointer;
	white-space: nowrap;
}
#pick-track:hover { background: #4a4a4a; border-color: #6cf; }
.file-name {
	color: #9cf;
	font-size: 13px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	min-width: 0;
}
#player {
	flex: 1 1 auto;
	width: auto;
	min-width: 0;
}
/* Source selector (File / Mic) — segmented control */
#source-select {
	display: flex;
	gap: 0;
	flex: 0 0 auto;
	border: 1px solid #555;
	border-radius: 6px;
	overflow: hidden;
}
.src-btn {
	background: #3a3a3a;
	color: #ddd;
	border: none;
	padding: 6px 12px;
	font-size: 13px;
	cursor: pointer;
	line-height: 1;
}
.src-btn + .src-btn { border-left: 1px solid #555; }
.src-btn:hover { background: #4a4a4a; }
.src-btn.active { background: #2c5a7a; color: #fff; }

/* ----- Control panel ----- */
#controls {
	display: none;            /* hidden until wired to an icon */
	background: #262626;
	padding: 12px 16px;
	border-top: 1px solid #444;
}
.ctrl-row {
	display: flex;
	flex-wrap: wrap;
	gap: 14px;
	align-items: flex-start;
	margin: 6px 0;
}
.ctrl-group {
	border: 1px solid #444;
	border-radius: 8px;
	padding: 8px 12px 10px;
	margin: 0;
	background: #2f2f2f;
}
.ctrl-group legend {
	padding: 0 8px;
	color: #6cf;
	font-weight: 600;
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}
.ctrl-group label {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin: 4px 10px 4px 0;
	white-space: nowrap;
	font-size: 13px;
	cursor: pointer;
}
.scale-group {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	margin-left: 8px;
	font-size: 13px;
}
.scale-group label { margin: 0 4px; }
.file-label {
	background: #3a3a3a;
	padding: 5px 10px;
	border-radius: 6px;
	cursor: pointer;
}
.val {
	display: inline-block;
	min-width: 42px;
	text-align: right;
	color: #9cf;
	font-variant-numeric: tabular-nums;
	font-size: 12px;
}
#controls input[type=range] {
	width: 200px;
	vertical-align: middle;
	cursor: pointer;
}

/* ----- Box threshold equalizer (under the canvas) -----
   Vertical via -webkit-appearance: slider-vertical + writing-mode.
   Positive value = boost (lower threshold = lights up more often). */
#eq-panel {
	display: none;            /* hidden until wired to an icon */
	background: #262626;
	border-top: 1px solid #444;
	border-bottom: 1px solid #444;
	padding: 10px 16px 12px;
}
.eq-title {
	color: #6cf;
	font-size: 12px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	margin-bottom: 8px;
}
.eq-buttons {
	margin-top: 10px;
	display: flex;
	justify-content: center;
	gap: 8px;
}
.eq-buttons button {
	background: #3a3a3a;
	color: #eee;
	border: 1px solid #555;
	border-radius: 6px;
	padding: 6px 8px;
	font-size: 13px;
	cursor: pointer;
	line-height: 1;
}
.eq-buttons button:hover { background: #4a4a4a; border-color: #6cf; }
.eq-buttons button:active { background: #2a2a2a; }

.eq-channels {
	display: flex;
	flex-direction: row;
	flex-wrap: nowrap;
	gap: 8px;
	align-items: flex-end;
	overflow-x: auto;        /* fallback for very narrow windows */
	padding-bottom: 4px;
}
.eq-channel {
	flex: 1 1 0;             /* evenly share the width */
	min-width: 42px;         /* protection from over-squeezing */
	display: flex;
	flex-direction: column;
	align-items: center;
}
.eq-val {
	font-size: 12px;
	color: #9cf;
	font-variant-numeric: tabular-nums;
	min-height: 16px;
	margin-bottom: 2px;
}
.eq-slider {
	-webkit-appearance: slider-vertical;
	appearance: slider-vertical;
	writing-mode: bt-lr;
	width: 22px;
	height: 220px;
	cursor: pointer;
}
.eq-label {
	font-size: 10px;
	color: #9cf;
	margin-top: 6px;
	white-space: nowrap;
}
