/* studio.css — 🎼 สตูดิโอ (ธีม YouTube: popup #212121, ไม่มีกล่องซ้อน, แบ่งด้วยเส้นบาง) */
.studio-overlay {
  position: fixed; inset: 0; z-index: 9990; background: rgba(0, 0, 0, 0.78);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.studio-overlay[hidden] { display: none; }
.studio-card {
  width: 100%; max-width: 980px; max-height: calc(100vh - 32px); display: flex; flex-direction: column;
  background: #212121; color: #f1f1f1; border-radius: 12px; box-shadow: 0 4px 32px rgba(0, 0, 0, 0.6);
  font-size: 14px; box-sizing: border-box;
}
.studio-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px 6px; }
.studio-head h3 { margin: 0; font-size: 18px; font-weight: 600; }
.studio-x {
  width: 34px; height: 34px; border-radius: 50%; border: 0; background: transparent; color: #aaa;
  font-size: 18px; cursor: pointer; line-height: 1;
}
.studio-x:hover { background: #3f3f3f; color: #fff; }
.studio-tabs {
  display: flex; gap: 8px; padding: 6px 18px 10px; overflow-x: auto; border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  scrollbar-width: none;
}
.studio-tabs button {
  flex: none; border: 0; border-radius: 8px; padding: 7px 12px; background: #272727; color: #f1f1f1;
  cursor: pointer; font: inherit; font-size: 13.5px; white-space: nowrap;
}
.studio-tabs button:hover { background: #3f3f3f; }
.studio-tabs button.is-on { background: #f1f1f1; color: #0f0f0f; }
.studio-body { padding: 14px 18px 18px; overflow-y: auto; }
.studio-dim { color: #aaa; font-size: 12.5px; }
.studio-err, .studio-bad { color: #ff4e45; }
.studio-good { color: #2ba640; font-size: 13px; }
.studio-warn { color: #ffd54f; font-size: 12.5px; margin-top: 4px; }
.studio-warn-t { color: #ffd54f; }
.studio-sub { font-weight: 600; font-size: 13px; margin: 14px 0 6px; color: #f1f1f1; }
.studio-sec { border-top: 1px solid rgba(255, 255, 255, 0.1); margin-top: 12px; padding-top: 4px; }
.studio-sec > summary { cursor: pointer; padding: 8px 0; font-weight: 600; font-size: 13.5px; }

/* ฟอร์ม */
.studio-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.studio-row > label, .studio-row > input, .studio-row > select { flex: 1 1 140px; min-width: 0; }
.studio-actions { margin-top: 10px; align-items: center; }
.studio-form { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.studio-body label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: #aaa; }
.studio-body input:not([type="checkbox"]), .studio-body select, .studio-body textarea {
  width: 100%; box-sizing: border-box; padding: 8px 11px; border-radius: 8px; border: 1px solid #303030;
  background: #121212; color: #f1f1f1; font: inherit; font-size: 14px;
}
.studio-body textarea { resize: vertical; line-height: 1.55; }
.studio-body input:focus, .studio-body select:focus, .studio-body textarea:focus { outline: none; border-color: #1c62b9; }
.studio-mono { font-family: inherit; white-space: pre-wrap; }
.studio-danger { color: #ff4e45 !important; }
.studio-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 8px 0; font-size: 12px; color: #aaa; }
.studio-chip { border: 0; border-radius: 12px; padding: 3px 9px; background: #272727; color: #9fd3ff; cursor: pointer; font: inherit; font-size: 12px; }
.studio-chip:hover { background: #3f3f3f; }

/* โน้ตเพลง: รายการซ้าย + ฟอร์มขวา */
.studio-split { display: grid; grid-template-columns: minmax(220px, 300px) 1fr; gap: 18px; }
.studio-list { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.studio-list .studio-row input { flex: 1 1 100px; }
#st-note-items { display: flex; flex-direction: column; max-height: 60vh; overflow-y: auto; }
.studio-item {
  display: flex; flex-direction: column; gap: 2px; text-align: left; border: 0; background: transparent; color: inherit;
  padding: 9px 10px; border-radius: 8px; cursor: pointer; font: inherit;
}
.studio-item:hover { background: rgba(255, 255, 255, 0.06); }
.studio-item.is-on { background: rgba(255, 255, 255, 0.12); }
.studio-item-title { font-size: 14px; color: #f1f1f1; overflow-wrap: anywhere; }
.studio-item-meta { font-size: 11.5px; color: #aaa; }

/* ปฏิทิน */
.studio-plan { display: grid; grid-template-columns: 300px 1fr; gap: 18px; align-items: start; }
.studio-cal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.studio-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.studio-cal-grid b { font-size: 11px; color: #717171; font-weight: 500; padding: 4px 0; }
.studio-day {
  position: relative; aspect-ratio: 1; border: 0; border-radius: 50%; background: transparent; color: #f1f1f1;
  cursor: pointer; font: inherit; font-size: 13px;
}
.studio-day:hover { background: #3f3f3f; }
.studio-day.is-today { outline: 1px solid #3ea6ff; }
.studio-day.has-ev { font-weight: 700; }
.st-dot { position: absolute; left: 50%; bottom: 3px; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; }
.st-todo { background: #ffd54f; }
.st-done { background: #2ba640; }
.studio-rel { border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.studio-rel-head {
  width: 100%; display: grid; grid-template-columns: 92px 1fr 70px; gap: 10px; align-items: center; text-align: left;
  border: 0; background: transparent; color: inherit; font: inherit; padding: 10px 4px; cursor: pointer; border-radius: 8px;
}
.studio-rel-head:hover { background: rgba(255, 255, 255, 0.05); }
.studio-rel-date, .studio-rel-title { display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; }
.studio-rel-date { font-size: 13px; }
.studio-rel small { font-size: 11.5px; color: #aaa; }
.studio-rel.is-late .studio-rel-date small { color: #ff4e45; }
.studio-progress { height: 4px; background: #3f3f3f; border-radius: 2px; overflow: hidden; }
.studio-progress i { display: block; height: 100%; background: #2ba640; }
.studio-rel-body { display: flex; flex-direction: column; gap: 10px; padding: 4px 4px 14px; }
.studio-check { display: flex; flex-direction: column; gap: 2px; }
.studio-check > label { flex-direction: row !important; align-items: flex-start; gap: 8px !important; color: #f1f1f1 !important;
  font-size: 13.5px !important; padding: 4px 0; cursor: pointer; }
.studio-check input[type="checkbox"] { margin-top: 3px; flex: none; accent-color: #3ea6ff; }
.studio-check input:checked + span { color: #717171; text-decoration: line-through; }

/* สุขภาพเพลย์ลิสต์ */
.studio-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 6px; }
.studio-summary div { display: flex; flex-direction: column; padding: 4px 0; }
.studio-summary strong { font-size: 24px; font-weight: 600; }
.studio-summary span { font-size: 12px; color: #aaa; }
.studio-summary .is-bad strong { color: #ff4e45; }
.studio-summary .is-warn strong { color: #ffd54f; }
.studio-summary .is-good strong { color: #2ba640; }
.studio-hp { padding: 6px 0; font-size: 13px; }
.studio-hp ul, .studio-ul { margin: 4px 0 0; padding-left: 20px; line-height: 1.7; font-size: 13px; }
.studio-body a { color: #3ea6ff; }

@media (max-width: 760px) {
  .studio-overlay { padding: 0; }
  .studio-card { max-height: 100vh; height: 100%; border-radius: 0; }
  .studio-body { padding: 12px; }
  .studio-split, .studio-plan { grid-template-columns: 1fr; }
  #st-note-items { max-height: 30vh; }
  .studio-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .studio-rel-head { grid-template-columns: 80px 1fr 44px; }
}
.studio-switch { flex-direction: row !important; align-items: center; gap: 10px !important; color: #f1f1f1 !important;
  font-size: 14px !important; cursor: pointer; }
.studio-switch input { width: 18px; height: 18px; accent-color: #3ea6ff; }
.studio-body a.btn { text-decoration: none; display: inline-flex; align-items: center; }

/* เครื่องมือรายเพลง */
.studio-tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px;
  padding: 10px 0; border-top: 1px solid rgba(255,255,255,.1); border-bottom: 1px solid rgba(255,255,255,.1); }
.studio-tool { text-align: left; border: 0; border-radius: 10px; padding: 10px 12px; background: #272727; color: #f1f1f1;
  font: inherit; font-size: 13.5px; cursor: pointer; }
.studio-tool:hover { background: #3f3f3f; }
.studio-tool i { font-style: normal; color: #2ba640; font-size: 11.5px; margin-left: 4px; }
.cr-row { padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,.08); display: flex; flex-direction: column; gap: 6px; }
.cr-pct { flex: 1 1 110px !important; }
.cr-roles { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.cr-roles label { flex-direction: row !important; align-items: center; gap: 4px !important; color: #ddd !important; font-size: 13px !important; cursor: pointer; }
.ch-split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ch-prev { background: #121212; border-radius: 8px; padding: 10px 12px; font-size: 16px; max-height: 420px; overflow: auto; }
.sl-items { margin: 0; padding-left: 22px; }
.sl-items li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 4px 0; flex-wrap: wrap; }
.sl-tools { display: flex; gap: 4px; align-items: center; }
.sl-tools b { min-width: 26px; text-align: center; font-size: 12px; }

/* แผ่นเนื้อเพลง + คอร์ด (ใช้ทั้งตัวอย่างและโหมดเล่นสด) */
.lv-sheet { line-height: 1.35; color: #f1f1f1; }
.lv-line { margin: 0 0 .35em; }
.lv-line.has-ch { margin-top: .9em; }
.lv-seg { display: inline-flex; flex-direction: column; vertical-align: bottom; white-space: pre; }
.lv-seg b { color: #ffd54f; font-size: .78em; font-weight: 700; min-height: 1.1em; padding-right: .3em; }
.lv-sec { color: #3ea6ff; font-weight: 700; margin: 1.1em 0 .2em; font-size: .85em; text-transform: uppercase; }
.lv-gap { height: .8em; }

/* โหมดเล่นสด เต็มจอ */
#ycc-live { position: fixed; inset: 0; z-index: 10100; background: #000; color: #f1f1f1; display: flex; flex-direction: column; }
#ycc-live .lv-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid #222; }
#ycc-live .lv-title { flex: 1 1 200px; font-weight: 600; font-size: 16px; overflow-wrap: anywhere; }
#ycc-live .lv-ctrl { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
#ycc-live button { border: 0; border-radius: 18px; padding: 8px 12px; background: #272727; color: #f1f1f1; font: inherit; font-size: 14px; cursor: pointer; min-width: 40px; }
#ycc-live button.is-on { background: #f1f1f1; color: #000; }
#ycc-live .lv-key { min-width: 54px; text-align: center; font-weight: 700; color: #ffd54f; }
#ycc-live .lv-body { flex: 1; overflow-y: auto; padding: 18px 22px 50vh; }
#ycc-live .lv-sheet { max-width: 1000px; margin: 0 auto; }
@media (max-width: 760px) {
  .ch-split { grid-template-columns: 1fr; }
  #ycc-live input[type="range"] { width: 90px; }
}

/* 🎤 จับเวลาเนื้อเพลง */
.ly-split { display: grid; grid-template-columns: minmax(260px, 1fr) 1fr; gap: 14px; align-items: start; }
.ly-player { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: 10px; overflow: hidden; }
.ly-player iframe, .ly-player > div { position: absolute; inset: 0; width: 100%; height: 100%; }
.ly-pad { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.ly-tap { border: 0; border-radius: 14px; padding: 18px; background: #3ea6ff; color: #0f0f0f; font: inherit; font-size: 17px;
  font-weight: 700; cursor: pointer; touch-action: manipulation; }
.ly-tap:active { transform: scale(.98); }
.ly-tap:disabled { opacity: .4; cursor: not-allowed; }
.ly-tap small { font-weight: 400; font-size: 12px; }
.ly-lines { margin: 0; padding-left: 0; list-style: none; max-height: 420px; overflow-y: auto; font-size: 15px; }
.ly-lines li { padding: 5px 8px; border-radius: 6px; color: #ccc; }
.ly-lines li code { color: #717171; font-size: 12px; margin-right: 6px; }
.ly-lines li.is-todo { color: #888; }
.ly-lines li.is-cur { background: rgba(62,166,255,.15); color: #fff; outline: 1px solid rgba(62,166,255,.5); }
.ly-lines li.is-play { color: #ffd54f; font-weight: 600; }
@media (max-width: 760px) { .ly-split { grid-template-columns: 1fr; } .ly-lines { max-height: 260px; } }

/* 🎚️ ห้องฟังเดโม (ฝั่งเจ้าของ) */
.dm-usage { height: 6px; background: #3f3f3f; border-radius: 3px; overflow: hidden; margin: 6px 0 4px; }
.dm-usage div { height: 100%; background: #3ea6ff; }
.dm-prog { height: 6px; background: #3f3f3f; border-radius: 3px; overflow: hidden; }
.dm-prog div { height: 100%; width: 0; background: #2ba640; transition: width .2s; }
.dm-head { grid-template-columns: 1fr !important; }
.dm-comments code { color: #ffd54f; font-size: 12px; margin-right: 4px; }
.dm-up input[type="file"] { padding: 6px; }
