/* ─────────────────────────────────────────────────────────────
   /music-studio — Suno 스타일 다크 뮤직 스튜디오
   styles.css의 토큰(--bg/--panel/--accent…)을 그대로 쓰고, 이 화면 전용
   레이아웃·칩·트랙카드·파형만 여기서 정의한다.
   ───────────────────────────────────────────────────────────── */

.music-body { background: var(--bg); }
.music-wrap { max-width: 1380px; padding-bottom: 40px; }

.studio-tag.music {
  background: linear-gradient(135deg, rgba(255, 92, 138, .2), rgba(124, 92, 255, .2));
  border: 1px solid rgba(255, 92, 138, .35);
  color: #ffd0dd;
}

/* ── 엔진 상태 바 */
.music-status {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 14px 0 18px; padding: 11px 16px;
  background: linear-gradient(180deg, #0e141d, #0b1017);
  border: 1px solid var(--border); border-radius: 12px;
  font-size: 12.5px; color: var(--muted);
}
.ms-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--muted-2); box-shadow: 0 0 0 3px rgba(139, 152, 171, .12);
}
.ms-dot.on { background: var(--mint); box-shadow: 0 0 0 3px rgba(36, 211, 165, .18); }
.ms-dot.off { background: var(--danger); box-shadow: 0 0 0 3px rgba(255, 96, 118, .18); }
.ms-dot.wait { background: var(--amber); }
.ms-label { color: var(--text); font-weight: 600; }
.ms-chip {
  padding: 3px 9px; border-radius: 999px; border: 1px solid var(--border);
  background: #0b1119; color: var(--muted); font-size: 11.5px; white-space: nowrap;
}
.ms-chip.ok { color: var(--mint); border-color: rgba(36, 211, 165, .35); background: var(--mint-soft); }
.ms-chip.warn { color: var(--amber); border-color: rgba(245, 181, 68, .35); background: var(--amber-soft); }
.ms-chip.off { color: var(--danger); border-color: rgba(255, 96, 118, .3); background: var(--danger-soft); }
.ms-meta { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--muted-2); }

/* ── 2단 그리드 */
.music-grid {
  display: grid; grid-template-columns: minmax(0, 1.02fr) minmax(0, 1fr);
  gap: 18px; align-items: start;
}
@media (max-width: 1080px) { .music-grid { grid-template-columns: 1fr; } }

.music-panel {
  background: linear-gradient(180deg, rgba(17, 24, 35, .92), rgba(10, 14, 21, .96));
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 16px 18px; box-shadow: var(--shadow);
}
.mp-head {
  display: flex; align-items: center; gap: 12px; justify-content: space-between;
  margin-bottom: 14px;
}
.mode-tabs { display: inline-flex; background: #0a0f16; border: 1px solid var(--border); border-radius: 999px; padding: 3px; }
.mode-tab {
  border: 0; background: transparent; color: var(--muted); padding: 6px 16px;
  border-radius: 999px; cursor: pointer; font-size: 12.5px; font-weight: 600;
}
.mode-tab.active { background: linear-gradient(135deg, #ff5c8a, #7c5cff); color: #fff; }
.mp-hint { font-size: 11.5px; color: var(--muted-2); text-align: right; }

.mp-block { margin-bottom: 14px; }
.mp-row { display: flex; gap: 12px; }
.mp-half { flex: 1; }
.mp-label { display: block; font-size: 12px; font-weight: 650; color: var(--muted); margin-bottom: 7px; letter-spacing: .01em; }
.mp-label-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.mp-label-row .mp-label { margin-bottom: 0; }
.mp-sub { font-size: 11px; color: var(--muted-2); }
.mp-duration { color: #ff9bb6; font-size: 12.5px; }
.mp-input {
  width: 100%; background: #070b11; border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; color: var(--text); font-size: 13px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.mp-input:focus { border-color: rgba(255, 92, 138, .55); box-shadow: 0 0 0 3px rgba(255, 92, 138, .12); }
.mp-topic { resize: vertical; min-height: 58px; }
.mp-lyrics {
  resize: vertical; min-height: 190px; line-height: 1.65;
  font-family: var(--mono); font-size: 12.5px; white-space: pre-wrap;
}
.mp-range { width: 100%; accent-color: #ff5c8a; }
.mp-scale { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--muted-2); margin-top: 4px; }

.chip-row { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  border: 1px solid var(--border); background: #0a1018; color: var(--muted);
  border-radius: 999px; padding: 7px 13px; cursor: pointer; font-size: 12px; font-weight: 600;
  transition: all .15s;
}
.chip:hover { border-color: #2c3a52; color: var(--text); }
.chip.active {
  color: #fff; border-color: transparent;
  background: linear-gradient(135deg, rgba(255, 92, 138, .85), rgba(124, 92, 255, .85));
  box-shadow: 0 6px 18px rgba(255, 92, 138, .18);
}
.chip .chip-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }

/* 토글 */
.mp-toggle-row { display: flex; align-items: center; gap: 12px; }
.switch { position: relative; display: inline-flex; }
.switch input { position: absolute; opacity: 0; }
.switch-track {
  width: 42px; height: 24px; border-radius: 999px; background: #141d2b; border: 1px solid var(--border);
  display: inline-flex; align-items: center; padding: 2px; transition: background .18s;
}
.switch-thumb { width: 18px; height: 18px; border-radius: 50%; background: #5a6880; transition: transform .18s, background .18s; }
.switch input:checked + .switch-track { background: rgba(255, 92, 138, .3); border-color: rgba(255, 92, 138, .5); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(18px); background: #ff7fa4; }

/* 실행 버튼 */
.mp-actions { display: flex; gap: 10px; margin-top: 4px; }
.music-generate {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  background: linear-gradient(135deg, #ff5c8a, #7c5cff); border: 0; color: #fff;
  padding: 13px 18px; border-radius: 12px; font-weight: 700; font-size: 14px; cursor: pointer;
  box-shadow: 0 10px 30px rgba(255, 92, 138, .22); transition: transform .12s, filter .15s;
}
.music-generate:hover { filter: brightness(1.07); }
.music-generate:active { transform: translateY(1px); }
.music-generate[disabled] { filter: grayscale(.4) brightness(.75); cursor: progress; }
.mg-icon { font-size: 11px; }

.music-progress { margin-top: 12px; padding: 11px 13px; border: 1px solid var(--border); border-radius: 11px; background: #080d14; }
.mp-bar { height: 4px; border-radius: 999px; background: #131b28; overflow: hidden; }
.mp-bar > span {
  display: block; height: 100%; width: 8%; border-radius: 999px;
  background: linear-gradient(90deg, #ff5c8a, #7c5cff); transition: width .4s linear;
}
.mp-progress-text { font-size: 12px; color: var(--muted); margin-top: 8px; font-family: var(--mono); }

/* ── 편곡 카드 */
.arrange-card, .stems-card {
  margin-top: 16px; padding: 14px; border: 1px solid var(--border); border-radius: 13px;
  background: linear-gradient(180deg, #0c1219, #090e15);
}
.ac-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 10px; }
.ac-title { font-size: 13.5px; font-weight: 700; }
.ac-sub { font-size: 11px; color: var(--muted-2); margin-top: 2px; }
.ac-badges { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.ac-badge { font-size: 10.5px; padding: 3px 8px; border-radius: 999px; background: #0a1018; border: 1px solid var(--border); color: var(--muted); font-family: var(--mono); }
.ac-badge.hot { color: #ffb3c6; border-color: rgba(255, 92, 138, .35); background: rgba(255, 92, 138, .08); }
.ac-chords { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.ac-chord { font-family: var(--mono); font-size: 11px; color: #b9c6dd; background: #0a1018; border: 1px solid var(--border-soft); border-radius: 7px; padding: 4px 8px; }
.ac-sections { display: flex; gap: 5px; margin: 8px 0 10px; flex-wrap: wrap; }
.ac-section { flex: 1 1 72px; min-width: 64px; padding: 7px 8px; border-radius: 9px; background: #0b1119; border: 1px solid var(--border-soft); }
.ac-section .as-name { font-size: 10.5px; font-weight: 700; color: #cdd8ea; }
.ac-section .as-note { font-size: 10px; color: var(--muted-2); margin-top: 2px; line-height: 1.35; }
.ac-section .as-energy { height: 3px; border-radius: 9px; margin-top: 5px; background: linear-gradient(90deg, #ff5c8a var(--e, 40%), #1a2331 var(--e, 40%)); }
.ac-instruments { display: flex; flex-direction: column; gap: 5px; }
.ac-inst { display: flex; gap: 8px; font-size: 11.5px; color: var(--muted); }
.ac-inst b { color: #dbe4f3; font-weight: 650; min-width: 66px; display: inline-block; }

/* ── 스템 */
.stem-list { display: flex; flex-direction: column; gap: 7px; }
.stem-item {
  display: flex; align-items: center; gap: 9px; padding: 8px 9px; border-radius: 10px;
  background: #0a1018; border: 1px solid var(--border-soft);
}
.stem-item.selected { border-color: rgba(255, 92, 138, .45); background: rgba(255, 92, 138, .06); }
.stem-check { width: 15px; height: 15px; accent-color: #ff5c8a; }
.stem-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.stem-main { flex: 1; min-width: 0; }
.stem-name { font-size: 12px; font-weight: 650; }
.stem-prompt { font-size: 10.5px; color: var(--muted-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stem-status { font-size: 10px; font-family: var(--mono); color: var(--muted-2); }
.stem-actions { display: flex; gap: 8px; align-items: center; margin-top: 10px; flex-wrap: wrap; }

/* ── 트랙 리스트 */
.music-tracks { position: sticky; top: 12px; }
@media (max-width: 1080px) { .music-tracks { position: static; } }
.track-tabs .track-tab {
  border: 0; background: transparent; color: var(--muted); padding: 6px 14px; border-radius: 999px;
  cursor: pointer; font-size: 12.5px; font-weight: 600;
}
.track-tabs .track-tab.active { background: #17202e; color: #fff; }
.track-list { display: flex; flex-direction: column; gap: 12px; max-height: calc(100vh - 220px); overflow-y: auto; padding-right: 4px; }
@media (max-width: 1080px) { .track-list { max-height: none; } }
.track-empty { padding: 40px 20px; text-align: center; color: var(--muted-2); font-size: 12.5px; border: 1px dashed var(--border); border-radius: 12px; }

.track-card {
  display: grid; grid-template-columns: 76px 1fr; gap: 12px; padding: 12px;
  border: 1px solid var(--border); border-radius: 13px;
  background: linear-gradient(135deg, rgba(20, 28, 40, .9), rgba(10, 14, 21, .95));
  animation: tc-in .35s ease both;
}
@keyframes tc-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.track-cover {
  width: 76px; height: 76px; border-radius: 10px; position: relative; overflow: hidden;
  display: flex; align-items: flex-end; justify-content: flex-start; padding: 8px;
  font-weight: 800; font-size: 19px; color: rgba(255, 255, 255, .92);
  text-shadow: 0 2px 10px rgba(0, 0, 0, .5);
}
.track-cover::after {
  content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(115deg, rgba(255, 255, 255, .07) 0 2px, transparent 2px 7px);
  mix-blend-mode: overlay;
}
.track-cover .tc-bars { position: absolute; right: 6px; bottom: 6px; display: flex; gap: 2px; align-items: flex-end; height: 22px; }
.track-cover .tc-bars i { width: 3px; border-radius: 2px; background: rgba(255, 255, 255, .55); }
.track-body { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.track-top { display: flex; align-items: flex-start; gap: 8px; }
.track-title { font-size: 13.5px; font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track-del { border: 0; background: transparent; color: var(--muted-2); cursor: pointer; font-size: 13px; padding: 2px 4px; border-radius: 6px; }
.track-del:hover { color: var(--danger); background: var(--danger-soft); }
.track-tags { display: flex; gap: 5px; flex-wrap: wrap; }
.ttag { font-size: 10px; padding: 2px 7px; border-radius: 999px; background: #0a1018; border: 1px solid var(--border-soft); color: var(--muted); font-family: var(--mono); }
.ttag.real { color: var(--mint); border-color: rgba(36, 211, 165, .3); background: var(--mint-soft); }
.ttag.vocal { color: #ffb3c6; border-color: rgba(255, 92, 138, .3); background: rgba(255, 92, 138, .07); }
.track-player { display: flex; align-items: center; gap: 9px; }
.tp-play {
  width: 30px; height: 30px; border-radius: 50%; border: 0; cursor: pointer; flex: 0 0 auto;
  background: linear-gradient(135deg, #ff5c8a, #7c5cff); color: #fff; font-size: 11px;
  display: inline-flex; align-items: center; justify-content: center;
}
.tp-wave { flex: 1; height: 24px; display: flex; align-items: center; gap: 1.6px; cursor: pointer; }
.tp-wave i { flex: 1; background: #26334a; border-radius: 2px; min-height: 2px; transition: background .1s; }
.tp-wave i.on { background: linear-gradient(180deg, #ff7fa4, #7c5cff); }
.tp-time { font-family: var(--mono); font-size: 10.5px; color: var(--muted-2); white-space: nowrap; }
.track-links { display: flex; gap: 8px; flex-wrap: wrap; }
.track-links button, .track-links a {
  font-size: 10.5px; padding: 4px 9px; border-radius: 7px; border: 1px solid var(--border);
  background: #0a1018; color: var(--muted); cursor: pointer; text-decoration: none;
}
.track-links button:hover, .track-links a:hover { color: var(--text); border-color: #2c3a52; }
.track-lyrics {
  display: none; margin-top: 6px; padding: 10px 11px; border-radius: 9px;
  background: #070b11; border: 1px solid var(--border-soft);
  font-family: var(--mono); font-size: 11.5px; line-height: 1.7; color: #b8c5da; white-space: pre-wrap;
  max-height: 190px; overflow-y: auto;
}
.track-lyrics.open { display: block; }
.track-lyrics .lyr-sec { color: #ff9bb6; font-weight: 700; display: block; margin-top: 7px; }
.track-lyrics .lyr-sec:first-child { margin-top: 0; }
.track-lyrics .lyr-sec.active { color: #fff; background: rgba(255, 92, 138, .16); border-radius: 5px; padding: 0 4px; }
.track-progress-line { height: 2px; background: #131b28; border-radius: 9px; overflow: hidden; margin-top: 2px; }
.track-progress-line span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #ff5c8a, #7c5cff); }

.music-foot {
  display: flex; justify-content: space-between; margin-top: 24px; padding-top: 14px;
  border-top: 1px solid var(--border-soft); color: var(--muted-2); font-size: 11px;
}

/* 작은 화면 보정 */
@media (max-width: 640px) {
  .music-wrap { padding: 0 12px 30px; }
  .studio-head { flex-direction: column; align-items: flex-start; gap: 8px; }
  .studio-nav { flex-wrap: wrap; }
  .mp-actions { flex-direction: column; }
  .track-card { grid-template-columns: 60px 1fr; }
  .track-cover { width: 60px; height: 60px; font-size: 16px; }
}
