:root {
  color-scheme: light;
  --ink: #111;
  --muted: #666;
  --line: #c8c8c8;
  --soft: #f4f4f2;
  --accent: #e4332a;
  --ok: #258849;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: #fff;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
  line-height: 1.45;
}

button, input, select, textarea { font: inherit; }
button { color: inherit; }

.page {
  width: min(900px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 130px;
}

.intro { max-width: 780px; margin-bottom: 24px; }
.eyebrow { margin-bottom: 10px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .13em; }
.title-row { display: flex; align-items: center; gap: 13px; }
h1 { margin: 0; font-size: clamp(30px, 5vw, 44px); line-height: 1; letter-spacing: -.04em; }
.intro p { margin: 14px 0 0; color: #333; font-size: 14px; line-height: 1.65; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.on-air { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--accent); border-radius: 999px; padding: 4px 8px; color: var(--accent); font-size: 10px; font-weight: 800; letter-spacing: .08em; }
.on-air i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(228,51,42,.12); }
.on-air.ok { border-color: var(--ok); color: var(--ok); }
.on-air.ok i { background: var(--ok); box-shadow: 0 0 0 4px rgba(37,136,73,.12); }
.on-air.down { border-color: var(--muted); color: var(--muted); }
.on-air.down i { background: var(--muted); box-shadow: none; }

.form-panel {
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field-group { display: flex; flex-direction: column; gap: 6px; }
.field-group.grow { flex: 1; min-width: 0; }
.field-label { font-size: 12px; font-weight: 700; color: var(--muted); }
.field-hint { font-size: 11px; color: #888; }
.fixed-value { font-size: 13px; color: var(--muted); padding: 9px 0; }
.checkbox-row { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); cursor: pointer; user-select: none; white-space: nowrap; }
.checkbox-row input { cursor: pointer; }
#instrumentalRow select { width: 100%; }

textarea, input[type="text"], input[type="number"], select {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
  outline: none;
  width: 100%;
}
textarea { resize: vertical; line-height: 1.6; }
textarea:focus, input:focus, select:focus { border-color: var(--ink); box-shadow: 0 0 0 2px rgba(0,0,0,.06); }

.field-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.field-row .field-group { flex: 1; min-width: 140px; }
.field-row.actions { align-items: center; }

.lyrics-picker { display: flex; gap: 8px; align-items: center; }
.lyrics-picker select { flex: 1; }

.search-field { position: relative; display: flex; align-items: center; gap: 8px; }
.search-field input { width: 100%; }

.random-artist-btn {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
}
.random-artist-btn:hover { border-color: var(--ink); background: var(--soft); }

.suggest {
  position: absolute;
  z-index: 30;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--ink);
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 8px 28px rgba(0,0,0,.12);
}
.suggest-item {
  padding: 9px 12px;
  font-size: 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--soft);
}
.suggest-item:last-child { border-bottom: 0; }
.suggest-item:hover, .suggest-item.active { background: var(--soft); }
.suggest-empty { padding: 10px 12px; font-size: 13px; color: var(--muted); }

.primary-btn {
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding: 10px 22px;
  background: var(--ink);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
}
.primary-btn:hover { background: #000; }
.primary-btn:disabled { opacity: .45; cursor: not-allowed; }

.text-button { border: 1px solid transparent; border-radius: 999px; padding: 9px 14px; background: transparent; color: var(--muted); cursor: pointer; }
.text-button:hover { border-color: var(--ink); color: var(--ink); }

.jobs-section { margin-top: 26px; }
.summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-bottom: 1px solid var(--ink); padding: 0 0 9px; color: var(--muted); font-size: 12px; }

.current-task { margin-top: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: #fbfbf9; }
.current-task-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.current-task-label { color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .08em; }
.current-task-head > span:last-child { color: var(--muted); font-size: 11px; }
.current-task .progress { margin-top: 8px; }
.current-task .progress-fill { background: var(--accent); }

.jobs-list { display: flex; flex-direction: column; gap: 10px; padding-top: 12px; }

.job {
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 14px;
  background: #fff;
}
.job.running { border-color: var(--ink); box-shadow: inset 3px 0 0 var(--accent); }
.job.completed { box-shadow: inset 3px 0 0 var(--ok); }
.job.failed { box-shadow: inset 3px 0 0 var(--accent); }

.job-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.job-status { font-size: 11px; font-weight: 800; letter-spacing: .08em; }
.job-status.queued { color: var(--muted); }
.job-status.running { color: var(--accent); }
.job-status.completed { color: var(--ok); }
.job-status.failed { color: var(--accent); }
.job-meta { color: var(--muted); font-size: 11px; }
.job-lyrics { margin-top: 8px; font-size: 12px; color: #555; max-height: 52px; overflow: hidden; text-overflow: ellipsis; white-space: pre-line; }
.job-error { margin-top: 8px; font-size: 12px; color: var(--accent); }

.progress { margin-top: 12px; }
.progress-track { height: 6px; border-radius: 999px; background: var(--soft); overflow: hidden; }
.progress-fill { height: 100%; width: 0; border-radius: 999px; background: var(--ink); transition: width .3s ease; }
.job.running .progress-fill { background: var(--accent); }
.job.completed .progress-fill { background: var(--ok); }
.progress-label { display: flex; justify-content: space-between; margin-top: 6px; font-size: 11px; color: var(--muted); }

.job-result { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.job-result-row { font-size: 12px; color: #555; }
.job-result-row b { font-weight: 700; color: var(--ink); }

.listen-button {
  margin-top: 12px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding: 8px 14px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}
.listen-button:hover { background: var(--ink); color: #fff; }

footer { display: flex; justify-content: space-between; gap: 24px; margin-top: 30px; border-top: 1px solid var(--line); padding-top: 14px; color: var(--muted); font-size: 11px; }
footer p { max-width: 720px; margin: 0; }

.player { position: fixed; z-index: 20; right: 0; bottom: 0; left: 0; border-top: 1px solid var(--ink); background: rgba(255,255,255,.96); box-shadow: 0 -8px 28px rgba(0,0,0,.08); backdrop-filter: blur(12px); }
.player-inner { display: grid; grid-template-columns: minmax(0,1fr) auto auto auto; align-items: center; gap: 14px; width: min(900px, calc(100% - 32px)); min-height: 82px; margin: 0 auto; }
.now-playing { min-width: 0; }
.now-label { color: var(--accent); font-size: 9px; font-weight: 800; letter-spacing: .12em; }
.now-name { overflow: hidden; margin-top: 2px; font-size: 15px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.player-status { color: var(--muted); font-size: 10px; }
.player audio { width: 280px; height: 40px; }
.player-actions { display: flex; gap: 6px; }
.close-player { border: 0; padding: 6px; background: transparent; color: var(--muted); font-size: 22px; cursor: pointer; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

.password-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.4);
  backdrop-filter: blur(2px);
}
.password-modal[hidden] { display: none; }
.password-box {
  width: min(360px, calc(100% - 32px));
  border: 1px solid var(--ink);
  border-radius: 13px;
  padding: 20px;
  background: #fff;
  box-shadow: 0 12px 40px rgba(0,0,0,.2);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.password-title { font-size: 17px; font-weight: 700; }
.password-desc { font-size: 13px; color: var(--muted); }
.password-box input {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
  outline: none;
  width: 100%;
}
.password-box input:focus { border-color: var(--ink); }
.password-error { font-size: 12px; color: var(--accent); }
.password-error[hidden] { display: none; }
.password-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

@media (max-width: 720px) {
  .page { padding-top: 24px; }
  .field-row { flex-direction: column; align-items: stretch; }
  .player-inner { grid-template-columns: minmax(0,1fr) auto; }
  .player audio { width: 100%; }
}
