* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
html,
body {
  height: 100%;
  background: #111;
  color: #eee;
  font-family: -apple-system, 'Helvetica Neue', Arial, sans-serif;
  overflow: hidden;
}
.app {
  height: 100vh;
  display: flex;
  flex-direction: column;
}
.topbar {
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
  padding: 12px 16px 4px;
}
.stage-area {
  flex: 1 1 auto; /* fills the space between top + bottom bars */
  min-height: 0; /* allow the canvas to shrink instead of overflowing */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  overflow: hidden;
}
#stage {
  max-width: 100%;
  max-height: 100%; /* scale to fit the available area, keep aspect ratio */
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
  background: #000;
}
.bottombar {
  position: relative; /* anchor for the floating panels */
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 8px 16px 14px;
}
.controls {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 10px 16px;
  border-radius: 14px;
  font-size: 13px;
}
.controls button {
  height: 34px;
  padding: 0 14px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.9);
  color: #111;
}
.controls button#export {
  background: #ff4f6e;
  color: #fff;
}
.controls button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.controls select,
.controls input[type='range'] {
  vertical-align: middle;
}
.controls select {
  height: 30px;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: #222;
  color: #eee;
  padding: 0 8px;
  font-size: 13px;
}
.controls .time {
  font-variant-numeric: tabular-nums;
  opacity: 0.85;
  min-width: 92px;
  text-align: center;
}
.controls #seek {
  width: 200px;
}
.controls .grp {
  display: flex;
  gap: 6px;
  align-items: center;
}
.controls label {
  opacity: 0.7;
}
.controls .sep {
  width: 1px;
  height: 24px;
  background: rgba(255, 255, 255, 0.18);
}
.controls .mini input {
  width: 70px;
}
/* Cover / Lyrics — "load content" actions, tinted to stand apart from the toggles */
.controls label.file {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 13px;
  border-radius: 8px;
  cursor: pointer;
  background: rgba(86, 140, 222, 0.22);
  border: 1px solid rgba(120, 165, 230, 0.45);
  color: #eaf1ff;
  font-weight: 600;
}
.controls label.file:hover {
  background: rgba(86, 140, 222, 0.34);
}
.controls label.file input {
  width: 0;
  height: 0;
  opacity: 0;
  position: absolute;
}
/* Circular play button */
.controls button.icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  padding: 0;
  font-size: 13px;
}
/* Info / Style — secondary toggle buttons (faint, clearly not the load actions) */
.controls button.ghost {
  background: transparent;
  color: #cfcfcf;
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-weight: 500;
}
.controls button.ghost:hover {
  background: rgba(255, 255, 255, 0.08);
}
/* Style panel (the tuning sliders, toggled by ⚙ Style) */
#styleForm.show {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  justify-content: center;
}
#styleForm .srow {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1 1 150px;
}
#styleForm .srow label {
  font-size: 12px;
  opacity: 0.7;
}
#styleForm .srow input {
  width: 100%;
}
#styleForm .srow.full {
  flex: 1 1 100%;
}
.fontctl {
  display: flex;
  gap: 8px;
}
.fontctl select {
  height: 32px;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: #222;
  color: #eee;
  padding: 0 8px;
  font-size: 13px;
  flex: 0 0 auto;
}
.fontctl input {
  flex: 1 1 auto;
  min-width: 0;
  height: 32px;
  width: auto;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: #1b1b1f;
  color: #eee;
  padding: 0 10px;
  font-size: 13px;
  font-family: inherit;
}
.fontctl input:focus {
  outline: none;
  border-color: #ff4f6e;
}
.fontctl button {
  height: 32px;
  padding: 0 16px;
  border-radius: 7px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.9);
  color: #111;
  flex: 0 0 auto;
}
.fontctl button:hover {
  background: #fff;
}
#status {
  font-size: 13px;
  color: #f0f0f2;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 7px 16px;
  border-radius: 999px;
  max-width: min(94vw, 920px);
  text-align: center;
  line-height: 1.35;
}
#status b {
  color: #ff7a95;
  font-weight: 700;
}
/* Floating overlay panels (Style / Info) — anchored above the bottom bar, never reflow the page */
.panel {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  display: none;
  width: min(94vw, 760px);
  max-height: 56vh;
  overflow: auto;
  background: rgba(26, 26, 30, 0.97);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.6);
  padding: 16px 18px;
  border-radius: 14px;
}
#metaForm.show {
  display: grid;
  grid-template-columns: repeat(2, minmax(200px, 1fr));
  gap: 10px 18px;
}
#metaForm .field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
#metaForm .field.wide {
  grid-column: 1 / -1;
}
#metaForm label {
  font-size: 12px;
  opacity: 0.75;
}
#metaForm .hint {
  opacity: 0.5;
  font-size: 11px;
}
#metaForm input,
#metaForm textarea {
  background: #1b1b1f;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  color: #eee;
  padding: 7px 10px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
}
#metaForm input:focus,
#metaForm textarea:focus {
  outline: none;
  border-color: #ff4f6e;
}

/* Song search */
.searchbar {
  position: relative;
  width: min(96vw, 760px);
}
.searchbar input {
  width: 100%;
  height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.08);
  color: #eee;
  padding: 0 16px;
  font-size: 15px;
  font-family: inherit;
}
.searchbar input:focus {
  outline: none;
  border-color: #ff4f6e;
}
#searchResults {
  display: none;
  position: absolute;
  top: 50px;
  left: 0;
  right: 0;
  z-index: 20;
  max-height: 54vh;
  overflow-y: auto;
  background: #1b1b1f;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.55);
}
#searchResults.show {
  display: block;
}
.sr-row {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 8px 12px;
  cursor: pointer;
}
.sr-row:hover {
  background: rgba(255, 255, 255, 0.08);
}
.sr-row img {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  object-fit: cover;
  background: #333;
  flex: 0 0 auto;
}
.sr-meta {
  min-width: 0;
}
.sr-title {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sr-sub {
  font-size: 12px;
  opacity: 0.6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sr-empty {
  padding: 14px 16px;
  font-size: 13px;
  opacity: 0.6;
}
