/* gORTS3Bot design system — "steel & bone". Direction and rules: wwwroot/css/README.md */

@font-face { font-family: "Sora"; src: url("fonts/sora-latin.woff2") format("woff2"); font-weight: 400 800; font-display: swap;
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Sora"; src: url("fonts/sora-latin-ext.woff2") format("woff2"); font-weight: 400 800; font-display: swap;
	unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Inter"; src: url("fonts/inter-latin.woff2") format("woff2"); font-weight: 400 700; font-display: swap;
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; src: url("fonts/inter-latin-ext.woff2") format("woff2"); font-weight: 400 700; font-display: swap;
	unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
	/* Colour: near-black gunmetal, bone-white text, a steel→bone brand gradient, and amber (the logo's eyes) as the hot
	   accent for what is switched on or being dragged. Every text pair passes WCAG AA (README). */
	--void: #0A0B0D;          /* page */
	--hull: #131519;          /* panels */
	--hull-raised: #1D2026;   /* inputs, hover, selected rows */
	--seam: #2E333B;          /* hairlines */
	--chitin: #EEEAE0;        /* primary text */
	--murmur: #9A9FA8;        /* secondary text */
	--signal: #63D48F;        /* live, connected */
	--spore: #F0655C;         /* errors, destructive */
	--ember: #FFB547;         /* waiting, reconnecting */
	--lilac: #E6C48C;         /* links, focus */
	--cyan: #FFB547;          /* the hot accent: amber */
	--violet: #7D8894;        /* steel */
	--bone: #E2DBCB;
	--brand: linear-gradient(120deg, #8E98A4, var(--bone));
	--signal-soft: rgb(99 212 143 / 0.12);
	--spore-soft: rgb(240 101 92 / 0.12);
	--ember-soft: rgb(255 181 71 / 0.12);
	--glass: rgb(19 21 25 / 0.74);

	/* Type: Sora for headings, bot names and the playing title; Inter for the interface. */
	--font-display: "Sora", "Segoe UI", system-ui, sans-serif;
	--font-body: "Inter", "Segoe UI", system-ui, sans-serif;
	--text-xs: 0.8125rem;
	--text-sm: 0.875rem;
	--text-md: 0.9375rem;
	--text-lg: 1.125rem;
	--text-xl: 1.5rem;
	--leading: 1.55;

	--s1: 0.25rem; --s2: 0.5rem; --s3: 0.75rem; --s4: 1rem; --s5: 1.5rem; --s6: 2rem; --s7: 3rem;
	--radius-control: 999px;
	--radius-surface: 16px;
	--radius-inner: 10px;

	--glow-signal: 0 8px 30px rgb(226 219 203 / 0.16);
	--lift: 0 1px 0 rgb(255 255 255 / 0.04) inset, 0 20px 40px rgb(0 0 0 / 0.35);

	--ease: cubic-bezier(0.2, 0.8, 0.2, 1);
	--fast: 120ms;
	--medium: 220ms;
	--rail-width: 5rem;
	color-scheme: dark;
}

@media (prefers-reduced-motion: reduce) {
	:root { --fast: 0ms; --medium: 0ms; }
	*, *::before, *::after { animation-duration: 0ms !important; transition-duration: 0ms !important; }
}

/* ---- Base ----------------------------------------------------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
	margin: 0;
	min-height: 100vh;
	background:
		radial-gradient(40rem 30rem at 8% -10%, rgb(125 136 148 / 0.16), transparent 70%),
		radial-gradient(40rem 30rem at 100% 110%, rgb(255 181 71 / 0.05), transparent 70%),
		radial-gradient(circle at 1px 1px, rgb(238 234 224 / 0.045) 1px, transparent 1.5px) 0 0 / 22px 22px,
		var(--void);
	background-attachment: fixed;
	color: var(--chitin);
	font-family: var(--font-body);
	font-size: var(--text-md);
	line-height: var(--leading);
	font-feature-settings: "cv11", "ss01";
	-webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; margin: 0 0 var(--s3); font-weight: 600; letter-spacing: -0.02em; }
h1 { font-size: 1.875rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 var(--s3); max-width: 70ch; }
a { color: var(--lilac); text-underline-offset: 0.2em; }
a:hover { color: var(--chitin); }
small, .quiet { color: var(--murmur); }
.num { font-variant-numeric: tabular-nums; }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--lilac); outline-offset: 2px; border-radius: var(--radius-inner); }

.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- Shell: token rail on wide screens, bottom bar on phones ----------------------------------------------------- */

.shell { display: grid; grid-template-columns: var(--rail-width) 1fr; min-height: 100vh; }

.rail {
	position: sticky;
	top: 0;
	height: 100vh;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--s3);
	padding: var(--s4) 0;
	background: rgb(10 13 20 / 0.6);
	backdrop-filter: blur(14px);
	border-right: 1px solid var(--seam);
	overflow-y: auto;
}

.rail-home { display: block; width: 2.75rem; height: 2.75rem; margin-bottom: var(--s3); }
.rail-home img { display: block; width: 100%; height: 100%; }

.rail-bot {
	position: relative;
	display: grid;
	place-items: center;
	width: 3rem; height: 3rem;
	border-radius: 14px;
	text-decoration: none;
	transition: background var(--fast) var(--ease);
}
.rail-bot:hover { background: var(--hull-raised); }
.rail-bot.active { background: var(--hull-raised); box-shadow: inset 0 0 0 1px var(--seam); }
.rail-bot.active::before { content: ""; position: absolute; left: -0.75rem; top: 25%; bottom: 25%; width: 3px; border-radius: 2px; background: var(--brand); }
.rail-bot .dot { position: absolute; right: 3px; bottom: 3px; width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--void); }

.rail-nav { margin-top: auto; display: flex; flex-direction: column; gap: var(--s1); width: 100%; padding: var(--s3) var(--s2) 0; border-top: 1px solid var(--seam); }
.rail-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: var(--s2) var(--s1); border-radius: var(--radius-inner); color: var(--murmur); font-size: 0.6875rem; font-weight: 500; text-decoration: none; }
.rail-nav a:hover, .rail-nav a.active { color: var(--chitin); background: var(--hull-raised); }
.rail-nav svg { width: 1.25rem; height: 1.25rem; }

.main { min-width: 0; padding: var(--s6) var(--s6) var(--s7); max-width: 78rem; }

@media (max-width: 720px) {
	.shell { grid-template-columns: 1fr; }
	.rail { position: fixed; inset: auto 0 0 0; height: auto; flex-direction: row; justify-content: flex-start; padding: var(--s2) var(--s3); border-right: 0; border-top: 1px solid var(--seam); overflow-x: auto; z-index: 20; }
	.rail-home { display: none; }
	.rail-bot { width: 2.75rem; height: 2.75rem; flex: none; }
	.rail-bot.active::before { display: none; }
	.rail-nav { flex-direction: row; margin: 0 0 0 auto; padding: 0 0 0 var(--s2); border-top: 0; border-left: 1px solid var(--seam); width: auto; }
	.main { padding: var(--s5) var(--s4) 6rem; }
}

/* ---- Page header ---------------------------------------------------------------------------------------------------- */

.page-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s5); }
.page-head h1 { margin: 0; }
.page-head p { margin: var(--s1) 0 0; color: var(--murmur); }

/* ---- Surfaces: frosted glass with a hairline -------------------------------------------------------------------- */

.panel {
	background: var(--glass);
	backdrop-filter: blur(16px);
	border: 1px solid var(--seam);
	border-radius: var(--radius-surface);
	box-shadow: var(--lift);
	padding: var(--s5);
}
.panel + .panel { margin-top: var(--s4); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s4); }
.panel-head h2 { margin: 0; }

/* ---- Buttons ------------------------------------------------------------------------------------------------------ */

.btn {
	display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
	min-height: 2.5rem; padding: 0 var(--s4);
	border-radius: var(--radius-control);
	border: 1px solid var(--seam);
	background: var(--hull-raised);
	color: var(--chitin);
	font: 600 var(--text-sm)/1 var(--font-body);
	cursor: pointer; text-decoration: none;
	transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease), transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.btn:hover { border-color: #3A4766; background: #212A3F; }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
.btn svg { width: 1.125rem; height: 1.125rem; flex: none; }

.btn-primary { background: var(--brand); border-color: transparent; color: var(--void); }
.btn-primary:hover { background: var(--brand); border-color: transparent; box-shadow: var(--glow-signal); }
.btn-danger { background: transparent; border-color: rgb(240 101 92 / 0.5); color: var(--spore); }
.btn-danger:hover { background: var(--spore-soft); border-color: var(--spore); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--murmur); }
.btn-ghost:hover { color: var(--chitin); background: var(--hull-raised); border-color: transparent; }

.btn-icon { width: 2.5rem; padding: 0; }
.btn-round { width: 3.5rem; height: 3.5rem; padding: 0; }
.btn-round svg { width: 1.375rem; height: 1.375rem; }
.btn-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }

/* ---- Forms -------------------------------------------------------------------------------------------------------- */

.field { display: grid; gap: var(--s1); margin-bottom: var(--s4); }
.field label { font-size: var(--text-sm); font-weight: 600; }
.field .hint { font-size: var(--text-xs); color: var(--murmur); }
.field .error { font-size: var(--text-xs); color: var(--spore); }

.input, select.input, textarea.input {
	width: 100%; min-height: 2.75rem; padding: var(--s2) var(--s3);
	background: rgb(10 13 20 / 0.6);
	border: 1px solid var(--seam);
	border-radius: var(--radius-inner);
	color: var(--chitin); font: inherit;
}
.input::placeholder { color: var(--murmur); opacity: 0.8; }
.input:hover { border-color: #3A4766; }
.input:focus-visible { outline: 2px solid var(--lilac); outline-offset: 1px; }
.input[aria-invalid="true"] { border-color: var(--spore); }
.input[readonly] { color: var(--murmur); }

.check { display: flex; align-items: center; gap: var(--s2); }
.check input { width: 1.125rem; height: 1.125rem; accent-color: var(--cyan); }

.range { -webkit-appearance: none; appearance: none; width: 100%; height: 1.5rem; background: transparent; --fill: 50%; }
.range::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(to right, var(--violet), var(--bone) var(--fill), var(--seam) var(--fill)); }
.range::-moz-range-track { height: 4px; border-radius: 2px; background: var(--seam); }
.range::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--brand); }
.range::-webkit-slider-thumb { -webkit-appearance: none; margin-top: -6px; width: 16px; height: 16px; border-radius: 50%; background: var(--chitin); border: 0; box-shadow: 0 0 0 4px rgb(255 181 71 / 0.25); }
.range::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--chitin); border: 0; box-shadow: 0 0 0 4px rgb(255 181 71 / 0.25); }

/* ---- Status ------------------------------------------------------------------------------------------------------ */

.status { display: inline-flex; align-items: center; gap: 6px; padding: 2px var(--s2); border-radius: var(--radius-control); background: rgb(154 159 168 / 0.12); font-size: var(--text-xs); font-weight: 600; color: var(--murmur); }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status.live { color: var(--signal); background: var(--signal-soft); }
.status.waiting { color: var(--ember); background: var(--ember-soft); }
.status.failed { color: var(--spore); background: var(--spore-soft); }
.status.off { color: var(--murmur); }

.notice { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3) var(--s4); border-radius: var(--radius-inner); border: 1px solid rgb(255 181 71 / 0.35); background: var(--ember-soft); margin-bottom: var(--s4); }
.notice.error { border-color: rgb(240 101 92 / 0.35); background: var(--spore-soft); }
.notice.ok { border-color: rgb(99 212 143 / 0.35); background: var(--signal-soft); }
.notice p { margin: 0; }

.live-badge { display: inline-flex; align-items: center; gap: 5px; padding: 1px var(--s2); border-radius: var(--radius-control); background: var(--spore-soft); color: var(--spore); font-size: var(--text-xs); font-weight: 700; }
.live-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---- Lists -------------------------------------------------------------------------------------------------------- */

.list { list-style: none; margin: 0; padding: 0; }
.row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: var(--s3); padding: var(--s2) var(--s3); border-radius: var(--radius-inner); min-height: 3.25rem; }
.row:hover { background: var(--hull-raised); }
.row.current { background: linear-gradient(90deg, rgb(142 152 164 / 0.16), rgb(255 181 71 / 0.06)); box-shadow: inset 0 0 0 1px rgb(142 152 164 / 0.3); }
.row.unavailable .row-title { color: var(--murmur); text-decoration: line-through; text-decoration-color: var(--spore); }
.row-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { font-size: var(--text-xs); color: var(--murmur); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.row-main { min-width: 0; }
.row-actions { display: flex; gap: var(--s1); }
.row .handle { cursor: grab; color: var(--murmur); }
.row .handle svg, .row-actions svg { width: 1.125rem; height: 1.125rem; }

/* ---- States ------------------------------------------------------------------------------------------------------- */

.state { display: grid; justify-items: start; gap: var(--s3); padding: var(--s6) var(--s5); border: 1px dashed var(--seam); border-radius: var(--radius-surface); color: var(--murmur); }
.state h3 { color: var(--chitin); margin: 0; }
.state p { margin: 0; }
.state.error { border-color: rgb(240 101 92 / 0.5); }
.spinner { width: 1.5rem; height: 1.5rem; border-radius: 50%; border: 2px solid var(--seam); border-top-color: var(--cyan); animation: spin 900ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Bot identity: tokens --------------------------------------------------------------------------------------- */

.bot-name { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.02em; }
.sigil { display: block; overflow: visible; }

/* Bot overview: a ledger of bots */
.constellation { display: grid; gap: var(--s2); }
.transmission {
	position: relative;
	display: grid;
	grid-template-columns: auto 1fr auto;
	gap: var(--s4);
	align-items: center;
	padding: var(--s3) var(--s4);
	border-radius: var(--radius-surface);
	background: var(--glass);
	border: 1px solid var(--seam);
	color: inherit;
	text-decoration: none;
	transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease);
}
.transmission:hover { border-color: #3A4766; background: rgb(27 34 51 / 0.72); }
.transmission.playing { border-color: transparent; background: linear-gradient(var(--hull), var(--hull)) padding-box, var(--brand) border-box; }
.transmission .bot-name { font-size: var(--text-lg); }
.transmission .where { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s3); color: var(--murmur); font-size: var(--text-sm); }
.transmission .now { margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--text-sm); }
.transmission .now.idle { color: var(--murmur); }
.transmission-meta { min-width: 0; }

@media (max-width: 720px) {
	.transmission { grid-template-columns: auto 1fr; gap: var(--s3); }
	.transmission > .btn-row { grid-column: 2; }
}

/* ---- Now playing ------------------------------------------------------------------------------------------------ */

.stage { display: grid; grid-template-columns: minmax(0, 1fr) minmax(18rem, 26rem); gap: var(--s6); align-items: start; }
@media (max-width: 960px) { .stage { grid-template-columns: 1fr; } }

/* The token beside its live pulse chart */
.membrane-wrap {
	position: relative;
	display: grid;
	grid-template-columns: auto 1fr;
	align-items: center;
	gap: var(--s4);
	width: 100%;
	padding: var(--s4);
	margin-bottom: var(--s5);
	border-radius: var(--radius-surface);
	border: 1px solid var(--seam);
	background: var(--glass);
}
.membrane-wrap .sigil { width: 4.5rem; height: 4.5rem; }
.membrane-wrap canvas { width: 100%; height: 6rem; display: block; }

.now-title { font-family: var(--font-display); font-weight: 700; font-size: clamp(1.75rem, 4vw, 2.75rem); line-height: 1.1; letter-spacing: -0.03em; margin: 0 0 var(--s2); overflow-wrap: anywhere; }
.now-artist { color: var(--murmur); font-size: var(--text-lg); margin-bottom: var(--s4); }

.progress { display: grid; grid-template-columns: auto 1fr auto; gap: var(--s3); align-items: center; font-size: var(--text-xs); color: var(--murmur); font-variant-numeric: tabular-nums; }
.transport { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); margin: var(--s4) 0; }
.transport .btn-round.btn-primary { box-shadow: var(--glow-signal); }
.volume { display: grid; grid-template-columns: auto 1fr 3ch; gap: var(--s3); align-items: center; max-width: 22rem; color: var(--murmur); font-variant-numeric: tabular-nums; }
.volume svg { width: 1.25rem; height: 1.25rem; }

/* ---- Toasts and dialogs ---------------------------------------------------------------------------------------- */

.toasts { position: fixed; right: var(--s4); bottom: var(--s4); display: grid; gap: var(--s2); z-index: 50; max-width: min(24rem, calc(100vw - 2rem)); }
@media (max-width: 720px) { .toasts { bottom: 5rem; left: var(--s4); right: var(--s4); } }
.toast { padding: var(--s3) var(--s4); border-radius: var(--radius-inner); background: rgb(27 34 51 / 0.92); backdrop-filter: blur(12px); border: 1px solid var(--seam); box-shadow: var(--lift); animation: toast-in var(--medium) var(--ease); }
.toast.error { border-color: rgb(240 101 92 / 0.5); }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } }

dialog.dialog { max-width: min(30rem, calc(100vw - 2rem)); padding: var(--s5); border-radius: var(--radius-surface); border: 1px solid var(--seam); background: var(--hull); color: var(--chitin); box-shadow: var(--lift); }
.dialog-overlay { position: fixed; inset: 0; display: grid; place-items: center; background: rgb(5 7 12 / 0.7); backdrop-filter: blur(4px); z-index: 60; padding: var(--s4); }
.dialog-overlay dialog.dialog { position: static; margin: 0; }

/* ---- Tabs / chips ---------------------------------------------------------------------------------------------- */

.tabs { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--radius-control); background: var(--hull); border: 1px solid var(--seam); margin-bottom: var(--s4); overflow-x: auto; max-width: 100%; }
.tabs a, .tabs button { padding: var(--s1) var(--s4); border: 0; border-radius: var(--radius-control); background: none; color: var(--murmur); font: 600 var(--text-sm)/1.6 var(--font-body); text-decoration: none; cursor: pointer; white-space: nowrap; }
.tabs .active { color: var(--chitin); background: var(--hull-raised); }

.chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.chip { padding: var(--s1) var(--s3); border-radius: var(--radius-control); border: 1px solid var(--seam); background: none; color: var(--chitin); font: 500 var(--text-sm)/1.4 var(--font-body); cursor: pointer; }
.chip[aria-pressed="true"] { border-color: transparent; background: linear-gradient(var(--hull-raised), var(--hull-raised)) padding-box, var(--brand) border-box; }

/* ---- Auth pages ------------------------------------------------------------------------------------------------ */

.auth { min-height: 100vh; display: grid; place-items: center; padding: var(--s5) var(--s4); }
.auth-box { width: min(100%, 26rem); }
.auth-box .wordmark { display: flex; align-items: center; gap: var(--s3); font-family: var(--font-display); font-weight: 700; font-size: var(--text-xl); letter-spacing: -0.02em; color: var(--chitin); margin-bottom: var(--s5); }
.auth-box .wordmark img { width: 3.5rem; height: 3.5rem; }

/* ---- Blazor plumbing -------------------------------------------------------------------------------------------- */

h1:focus { outline: none; }
.validation-message { color: var(--spore); font-size: var(--text-xs); }
.invalid { border-color: var(--spore) !important; }
.blazor-error-boundary { padding: var(--s4); border-radius: var(--radius-inner); background: var(--spore-soft); border: 1px solid var(--spore); color: var(--chitin); }
.blazor-error-boundary::after { content: "Something went wrong on this part of the page. Reload to try again."; }

/* Blazor shows this bar (display: block) only when the circuit hits an unhandled error. */
#blazor-error-ui { display: none; position: fixed; left: 0; right: 0; bottom: 0; padding: var(--s3) var(--s4); background: var(--spore); color: var(--void); font-weight: 600; z-index: 100; }
#blazor-error-ui a { color: var(--void); }
#blazor-error-ui .dismiss { cursor: pointer; float: right; }

/* Admin: identity UIDs and similar copyable values wrap instead of overflowing */
.uid { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; user-select: all; color: var(--chitin); }
.readonly-note { font-size: var(--text-xs); color: var(--ember); }
textarea.input { min-height: 6rem; resize: vertical; font-family: inherit; line-height: 1.5; }

/* Now playing: embedded cover beside the title */
.now-head { display: flex; gap: var(--s4); align-items: center; }
.cover { width: 72px; height: 72px; flex: none; border-radius: var(--radius-inner); object-fit: cover; box-shadow: var(--lift); }

/* Queue reordering: drop target line, and the keyboard up/down buttons */
.row.drop-target { box-shadow: inset 0 2px 0 var(--cyan); }
.row .move { font-size: var(--text-md); line-height: 1; }
@media (max-width: 480px) {
	.row .move { display: none; } /* drag still works; the row stays readable at 360 px */
}

/* Library, stations, playlists */
.target { display: inline-flex; align-items: center; gap: var(--s2); font-size: var(--text-sm); color: var(--murmur); white-space: nowrap; }
.target select { width: auto; min-width: 10rem; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1); margin-bottom: var(--s3); color: var(--murmur); }
.pager { justify-content: center; margin-top: var(--s4); }
.playlist-pick { width: auto; max-width: 9rem; min-height: 0; padding-block: var(--s1); font-size: var(--text-xs); }
@media (max-width: 480px) {
	.playlist-pick { display: none; }
}

/* Fixes from the P04-T03 drive: folder rows are buttons; icons inside rows and tabs; long toast text */
button.row { width: 100%; background: none; border: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.row > svg { width: 1.25rem; height: 1.25rem; color: var(--murmur); }
.tabs button { display: inline-flex; align-items: center; gap: var(--s2); white-space: nowrap; }
.tabs svg { width: 1rem; height: 1rem; flex: none; }
.toast { overflow-wrap: anywhere; }
.btn { white-space: nowrap; }

/* Listen along: the toggle, its status line, and a volume that only this browser uses */
.listen { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); margin-top: var(--s4); }
.listen.compact { display: inline-flex; margin-top: 0; flex-wrap: nowrap; }
.listen .btn.on { color: var(--cyan); box-shadow: inset 0 0 0 1px rgb(255 181 71 / 0.45); }
.listen-status { font-size: var(--text-xs); color: var(--signal); white-space: nowrap; }
.listen.compact .listen-status { max-width: 9rem; overflow: hidden; text-overflow: ellipsis; }
.listen-status.stopped { color: var(--spore); }
.listen-volume { flex: 1 1 14rem; }
.btn-link { background: none; border: 0; padding: 0; color: var(--lilac); font: inherit; text-decoration: underline; cursor: pointer; }
.page-head .listen { margin-top: 0; justify-content: flex-end; max-width: 28rem; }

/* ---- Player bar: the mini player at the bottom of every page (stays while navigating) ------------------------------ */

.playerbar {
	position: fixed; left: var(--rail-width); right: 0; bottom: 0; z-index: 15;
	display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: var(--s4);
	padding: var(--s2) var(--s5); background: var(--hull); border-top: 1px solid var(--seam);
}
.pb-bot { width: auto; max-width: 11rem; min-height: 0; padding-block: var(--s1); font-size: var(--text-sm); }
.pb-bot-name { font-weight: 600; font-size: var(--text-sm); white-space: nowrap; }
.pb-now { display: grid; min-width: 0; color: inherit; text-decoration: none; line-height: 1.3; }
.pb-now:hover .pb-title { text-decoration: underline; }
.pb-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pb-title.idle { color: var(--murmur); font-weight: 500; }
.pb-sub { font-size: var(--text-xs); color: var(--murmur); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pb-controls, .pb-listen { display: flex; align-items: center; gap: var(--s1); }
.pb-listen .btn.on { color: var(--cyan); box-shadow: inset 0 0 0 1px rgb(255 181 71 / 0.45); }
.pb-volume { width: 6rem; }
.pb-listeners { font-size: var(--text-xs); color: var(--murmur); white-space: nowrap; font-variant-numeric: tabular-nums; }
.main { padding-bottom: calc(var(--s7) + 4rem); }   /* room for the bar */

@media (max-width: 720px) {
	.playerbar { left: 0; bottom: 3.75rem; grid-template-columns: minmax(0, 1fr) auto auto; gap: var(--s2); padding: var(--s2) var(--s3); }
	.pb-bot, .pb-bot-name, .pb-volume { display: none; }
	.main { padding-bottom: 10rem; }
	.toasts { bottom: 9rem; }
}

/* The running version, under the rail's links */
.rail-version { display: block; margin-top: var(--s2); font-size: 0.625rem; color: var(--murmur); text-align: center; font-variant-numeric: tabular-nums; }
@media (max-width: 720px) { .rail-version { display: none; } }


/* Listener count beside a bot's status in the bot list. */
.transmission .where .listeners { display: inline-flex; align-items: center; gap: var(--s1); }
.transmission .where .listeners svg { width: 0.95em; height: 0.95em; }

/* Admin: tabs on top, then one column of sections; a save bar appears when something changed. */
.admin { max-width: 60rem; }
.admin-tabs { margin-bottom: var(--s5); }
.back { display: flex; width: fit-content; align-items: center; gap: var(--s1); margin-bottom: var(--s3); color: var(--murmur); font-size: var(--text-sm); font-weight: 600; text-decoration: none; }
.back:hover { color: var(--chitin); }
.admin .panel > h2 { margin: 0 0 var(--s1); }
.admin .panel > h2:only-child, .admin .panel > h2 + :not(.section-desc) { margin-bottom: var(--s4); }
.section-desc { margin: 0 0 var(--s4); color: var(--murmur); font-size: var(--text-sm); }
.admin .panel h3 { margin: var(--s5) 0 var(--s1); font-size: var(--text-sm); font-weight: 600; }
.admin .panel h3:first-of-type { margin-top: 0; }
.field-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 0 var(--s4); }
.option { margin-bottom: var(--s3); }
.option .hint { display: block; margin: 2px 0 0 calc(1.125rem + var(--s2)); font-size: var(--text-xs); color: var(--murmur); }
.savebar {
	position: sticky; bottom: calc(4.25rem + var(--s2)); z-index: 14;
	display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s3);
	margin-top: var(--s4); padding: var(--s3) var(--s4); border-radius: var(--radius-surface);
	background: var(--hull-raised); border: 1px solid var(--seam); box-shadow: var(--lift);
}
.savebar p { margin: 0; font-size: var(--text-sm); font-weight: 600; }
.savebar .btn-row { margin-left: auto; }
.panel.danger { border-color: rgb(240 101 92 / 0.3); }
details.advanced > summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
details.advanced > summary::-webkit-details-marker { display: none; }
details.advanced > summary h2 { margin: 0; }
details.advanced > summary::after { content: "Show"; font-size: var(--text-sm); font-weight: 600; color: var(--murmur); }
details.advanced[open] > summary::after { content: "Hide"; }
details.advanced[open] > summary { margin-bottom: var(--s4); }
a.row { color: inherit; text-decoration: none; }
.status-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); }
.status-head .grow { flex: 1 1 14rem; min-width: 0; }
.status-head h2 { margin: 0; }
.inline-form { margin-bottom: var(--s4); }
.attention { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.attention li { margin: 0; }
.overview-row { grid-template-columns: auto minmax(0, 1fr) auto; }
.overview-row .chev { color: var(--murmur); font-size: var(--text-md); }
@media (max-width: 720px) { .savebar { bottom: calc(9rem + var(--s2)); } }

/* The bot page's queue scrolls inside its panel instead of making the page longer. */
.queue-list { max-height: calc(100vh - 22rem); min-height: 12rem; overflow-y: auto; overscroll-behavior: contain; margin-right: calc(-1 * var(--s2)); padding-right: var(--s2); position: relative; }
.queue-list { scrollbar-width: thin; scrollbar-color: var(--seam) transparent; }
@media (max-width: 960px) { .queue-list { max-height: 60vh; } }

/* The small spectrum in the player bar, between the song and the controls. */
.playerbar { grid-template-columns: auto minmax(0, 1fr) auto auto auto; }
.pb-spectrum { width: 9rem; height: 2.25rem; display: block; }
@media (max-width: 960px) { .pb-spectrum { width: 6rem; } }
@media (max-width: 720px) {
	.playerbar { grid-template-columns: minmax(0, 1fr) auto auto; }
	.pb-spectrum { display: none; }
}

.queue-count { margin-left: var(--s2); font: 500 var(--text-sm)/1 var(--font-body); color: var(--murmur); font-variant-numeric: tabular-nums; }

/* Album art: a large cover on the bot's page with a glow in the cover's own colour (js/art.js sets --art-rgb), and a
   small cover in the player bar. */
.now-head.art-host { position: relative; isolation: isolate; gap: var(--s5); margin-bottom: var(--s2); }
.now-head.art-host::before {
	content: ""; position: absolute; z-index: -1; inset: -5rem -2rem -5rem -7rem; pointer-events: none;
	background: radial-gradient(closest-side at 22% 50%, rgb(var(--art-rgb, 0 0 0) / 0.3), transparent);
	opacity: 0; transition: opacity 600ms var(--ease);
}
.now-head.art-host.has-art::before { opacity: 1; }
.cover { width: 11rem; height: 11rem; border-radius: var(--radius-surface); box-shadow: var(--lift), 0 18px 60px rgb(var(--art-rgb, 0 0 0) / 0.35); }
@media (max-width: 720px) { .cover { width: 6rem; height: 6rem; border-radius: var(--radius-inner); } }
.pb-now { grid-template-columns: auto minmax(0, 1fr); }
.pb-now > span { grid-column: 2; }
.pb-cover { grid-column: 1; grid-row: 1 / span 2; align-self: center; width: 2.25rem; height: 2.25rem; margin-right: var(--s3); border-radius: 6px; object-fit: cover; }
@media (prefers-reduced-motion: reduce) { .now-head.art-host::before { transition: none; } }

/* The visual's style button: in the corner of the visual's box. */
.membrane-wrap .viz-style { position: absolute; top: var(--s1); right: var(--s1); min-height: 0; padding: 2px var(--s2); font-size: 0.6875rem; color: var(--murmur); opacity: 0; transition: opacity var(--fast) var(--ease); }
.membrane-wrap:hover .viz-style, .membrane-wrap .viz-style:focus-visible { opacity: 1; }
@media (hover: none) { .membrane-wrap .viz-style { opacity: 1; } }

/* The big-screen page: one bot, the whole window. */
.screen { position: fixed; inset: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: var(--s5); padding: clamp(1rem, 3vw, 3rem); background: var(--void); overflow: hidden; }
.screen-top { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); transition: opacity 500ms var(--ease); }
.screen-bot { display: flex; align-items: center; gap: var(--s3); min-width: 0; }
.screen-bot-name { font: 700 var(--text-lg)/1.2 var(--font-display); }
.screen-bot-sub { color: var(--murmur); font-size: var(--text-sm); }
.screen-actions { display: flex; gap: var(--s2); transition: opacity 500ms var(--ease); }
.screen-stage { position: relative; min-height: 0; }
.screen-visual { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.screen-stage .viz-style { position: absolute; right: 0; bottom: 0; transition: opacity 500ms var(--ease); }
.screen.idle .screen-actions, .screen.idle .viz-style { opacity: 0; pointer-events: none; }
.screen.idle { cursor: none; }
.screen-now { position: relative; isolation: isolate; display: flex; align-items: center; gap: clamp(1rem, 2.5vw, 2.5rem); min-width: 0; }
.screen-now::before {
	content: ""; position: absolute; z-index: -1; inset: -40vh -10vw -20vh -10vw; pointer-events: none;
	background: radial-gradient(closest-side at 20% 70%, rgb(var(--art-rgb, 0 0 0) / 0.28), transparent);
	opacity: 0; transition: opacity 800ms var(--ease);
}
.screen-now.has-art::before { opacity: 1; }
.screen-cover { width: clamp(6rem, 14vw, 13rem); height: clamp(6rem, 14vw, 13rem); flex: none; border-radius: var(--radius-surface); object-fit: cover; box-shadow: var(--lift), 0 18px 60px rgb(var(--art-rgb, 0 0 0) / 0.4); }
.screen-text { min-width: 0; flex: 1; }
.screen-title { font: 700 clamp(2rem, 5.5vw, 5rem)/1.05 var(--font-display); letter-spacing: -0.03em; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.screen-title.idle { color: var(--murmur); }
.screen-artist { margin-top: var(--s2); color: var(--murmur); font-size: clamp(1.125rem, 2.2vw, 2rem); }
.screen-progress { display: flex; align-items: center; gap: var(--s3); margin-top: var(--s4); color: var(--murmur); font-size: var(--text-md); font-variant-numeric: tabular-nums; }
.screen-track { flex: 1; height: 4px; border-radius: 2px; background: var(--seam); overflow: hidden; }
.screen-track > div { height: 100%; background: var(--brand); transition: width 500ms linear; }
@media (prefers-reduced-motion: reduce) { .screen-track > div { transition: none; } }

/* ---- Library: folders on the left, a table of tracks on the right, each scrolling on its own ---------------------- */
.lib-head { margin-bottom: var(--s3); }
.lib-toolbar { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; margin-bottom: var(--s3); }
.lib-search { position: relative; flex: 1 1 20rem; min-width: 0; display: flex; gap: var(--s2); align-items: center; }
.lib-search > svg { position: absolute; left: var(--s3); width: 1rem; height: 1rem; color: var(--murmur); pointer-events: none; }
.lib-search .input { padding-left: calc(var(--s3) + 1.5rem); }
.lib-toolbar .lib-filter { width: auto; flex: 0 0 auto; min-width: 9rem; }
.lib { display: grid; grid-template-columns: minmax(13rem, 17rem) minmax(0, 1fr); gap: var(--s4); height: calc(100vh - 19rem); min-height: 22rem; }
.lib > .panel { padding: var(--s3); display: flex; flex-direction: column; min-height: 0; }
.lib > .panel + .panel { margin-top: 0; }
.lib-folders { gap: var(--s2); }
.lib-path { display: flex; flex-wrap: wrap; align-items: center; gap: 2px var(--s1); font-size: var(--text-sm); color: var(--murmur); }
.lib-path button { border: 0; background: none; color: var(--murmur); font: inherit; padding: 2px var(--s1); border-radius: 6px; cursor: pointer; max-width: 12rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-path button:hover { color: var(--chitin); background: var(--hull-raised); }
.lib-path button.here { color: var(--chitin); font-weight: 600; }
.lib-folder-filter { min-height: 0; padding-block: var(--s1); font-size: var(--text-sm); }
.lib-folder-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; min-height: 0; scrollbar-width: thin; scrollbar-color: var(--seam) transparent; }
.lib-folder-list button { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--s2); align-items: center; width: 100%; padding: 6px var(--s2); border: 0; border-radius: var(--radius-inner); background: none; color: var(--chitin); font: inherit; font-size: var(--text-sm); text-align: left; cursor: pointer; }
.lib-folder-list button:hover { background: var(--hull-raised); }
.lib-folder-list svg { width: 1rem; height: 1rem; color: var(--murmur); }
.lib-folder-list span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-folder-list small { color: var(--murmur); font-variant-numeric: tabular-nums; }
.lib-empty { padding: var(--s2); color: var(--murmur); font-size: var(--text-sm); }
.lib-tracks { gap: var(--s2); }
.lib-tracks-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: 0 var(--s1); }
.lib-tracks-head h2 { margin: 0; font-size: var(--text-lg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-table-wrap { flex: 1; min-height: 0; overflow: auto; scrollbar-width: thin; scrollbar-color: var(--seam) transparent; border-top: 1px solid var(--seam); }
.lib-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); table-layout: fixed; }
.lib-table thead th { position: sticky; top: 0; z-index: 1; background: var(--hull); text-align: left; font-weight: 600; color: var(--murmur); padding: var(--s2); border-bottom: 1px solid var(--seam); }
.lib-table td { padding: 4px var(--s2); border-bottom: 1px solid rgb(46 51 59 / 0.5); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
.lib-table tbody tr:hover { background: var(--hull-raised); }
.lib-table tr.unavailable td { color: var(--murmur); text-decoration: line-through; }
.lib-sort { border: 0; background: none; color: inherit; font: inherit; padding: 0; cursor: pointer; }
.lib-sort:hover, .lib-sort.active { color: var(--chitin); }
.c-art { width: 3rem; }
.c-title { width: 28%; }
.c-artist { width: 18%; }
.c-album { width: 18%; }
.c-tags { width: 15%; }
.c-len { width: 4.5rem; text-align: right; font-variant-numeric: tabular-nums; }
.lib-table th.c-len { text-align: right; }
.c-act { width: 15rem; }
.lib-cell-main { font-weight: 600; color: var(--chitin); }
.lib-thumb { position: relative; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 6px; background: var(--hull-raised); overflow: hidden; }
.lib-thumb svg { width: 1rem; height: 1rem; color: var(--murmur); }
.lib-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.lib-tags { display: inline-flex; gap: 4px; flex-wrap: nowrap; max-width: 100%; overflow: hidden; border: 0; background: none; padding: 2px; border-radius: 6px; cursor: pointer; color: inherit; font: inherit; }
.lib-tags:disabled { cursor: default; }
.lib-tags:not(:disabled):hover { background: var(--hull-raised); box-shadow: inset 0 0 0 1px var(--seam); }
.lib-tags.manual .chip-tag { box-shadow: inset 0 0 0 1px rgb(255 181 71 / 0.4); }
.chip-tag { padding: 1px 7px; border-radius: 999px; background: rgb(142 152 164 / 0.16); color: var(--chitin); font-size: var(--text-xs); white-space: nowrap; }
.chip-tag.mood { background: rgb(255 181 71 / 0.12); color: var(--ember); }
.lib-tag-edit { display: flex; gap: 4px; align-items: center; }
.lib-tag-edit .input { min-height: 0; padding: 2px 4px; font-size: var(--text-xs); width: auto; max-width: 6.5rem; }
.lib-actions { display: flex; gap: 2px; align-items: center; justify-content: flex-end; }
.lib-actions .btn-icon { min-height: 0; padding: 5px; }
.lib-bot, .lib-playlist { width: auto; max-width: 7.5rem; min-height: 0; padding: 3px 6px; font-size: var(--text-xs); }
.lib-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2); padding: var(--s1) var(--s1) 0; border-top: 1px solid var(--seam); }
.lib-pages { display: flex; gap: 2px; align-items: center; }
.lib-pages .btn { min-height: 0; min-width: 2rem; padding: 3px 8px; font-size: var(--text-sm); }
.lib-size { display: inline-flex; align-items: center; gap: var(--s2); font-size: var(--text-xs); color: var(--murmur); }
.lib-size .input { width: auto; min-height: 0; padding: 2px 6px; font-size: var(--text-xs); }
@media (max-width: 1100px) { .c-album, .c-tags { display: none; } .c-title { width: 40%; } .c-artist { width: 25%; } }
@media (max-width: 860px) {
	.lib { grid-template-columns: 1fr; height: auto; }
	.lib-folders { max-height: 14rem; }
	.lib-tracks { height: 70vh; }
	.c-art, .c-len { display: none; }
	.c-act { width: 9rem; }
	.lib-bot, .lib-playlist { display: none; }
}

/* The library uses the whole width: a table wants room. */
.main:has(.lib) { max-width: none; }
