:root {
  color-scheme: dark;
  --bg: #0b0e14;
  --panel: #151923;
  --panel-2: #1b202c;
  --border: #2b3240;
  --muted: #8d97a8;
  --text: #eef1f7;
  --accent: #7c5cff;
  --accent-2: #39d0c8;
  --danger: #ff5e7a;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-width: 0; height: 100%; background: var(--bg); color: var(--text); font-family: "Malgun Gothic", "Segoe UI", sans-serif; }
button, input, select, textarea { font: inherit; }
button, .button {
  border: 1px solid var(--border); border-radius: 8px; background: #242a37; color: var(--text);
  padding: 8px 12px; cursor: pointer; transition: .16s ease; white-space: nowrap;
}
button:hover, .button:hover { border-color: #59647a; transform: translateY(-1px); }
button:disabled { opacity: .45; cursor: default; transform: none; }
.ghost { background: transparent; }
.accent { padding: 6px 9px; border-radius: 7px; background: linear-gradient(135deg, #6950e8, #8b68ff); border-color: #9279ff; font-size: 11px; }
.topbar {
  height: 66px; display: flex; align-items: center; gap: 18px; padding: 0 22px;
  border-bottom: 1px solid var(--border); background: #11151d; position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 220px; }
.brand-mark { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 10px; font-weight: 900; background: linear-gradient(145deg, var(--accent), #3bc7c1); }
.brand strong, .brand span { display: block; }
.brand span { color: var(--muted); font-size: 11px; margin-top: 2px; }
.project-title { flex: 0 1 450px; min-width: 0; display: flex; align-items: center; gap: 8px; }
.project-name-label { flex: 0 0 auto; color: var(--muted); font-size: 11px; white-space: nowrap; }
.project-title input { flex: 1 1 170px; min-width: 120px; max-width: 260px; background: transparent; border: 0; border-bottom: 1px solid transparent; color: var(--text); font-size: 17px; font-weight: 700; padding: 5px; }
.project-title input:focus { outline: 0; border-color: var(--accent); }
.save-state { color: var(--muted); font-size: 12px; }
.manual-btn { flex: 0 0 auto; padding: 6px 9px; font-size: 11px; }
.top-actions { display: flex; gap: 7px; }
.top-actions #toggleMp4ExportBtn.active { border-color: #9279ff; color: #fff; background: linear-gradient(135deg, #5146b8, #6950e8); }
.workspace { display: grid; grid-template-columns: 330px minmax(0, 1fr); height: calc(100vh - 66px); }
.sidebar { overflow-y: auto; border-right: 1px solid var(--border); background: #10141c; padding: 14px; }
.editor { min-width: 0; overflow: auto; padding: 16px; }
.preview-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .75fr); gap: 12px; align-items: stretch; }
.preview-layout .preview-card { min-width: 0; }
.preview-side-tools { min-width: 0; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); }
.preview-side-title { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.preview-side-title b { font-size: 13px; }
.preview-side-title small { color: var(--muted); font-size: 10px; }
.panel, .preview-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); }
.sidebar .panel { padding: 13px; margin-bottom: 12px; }
.panel-title { display: flex; align-items: center; gap: 8px; margin-bottom: 11px; }
.panel-title > span { width: 23px; height: 23px; border-radius: 7px; display: grid; place-items: center; background: #2c3240; color: #bdb5ff; font-size: 12px; font-weight: 800; }
.panel-title h2 { font-size: 14px; margin: 0; flex: 1; }
.icon-btn { padding: 6px 8px; font-size: 12px; }
.dropzone { min-height: 84px; display: flex; flex-direction: column; justify-content: center; gap: 7px; border: 1px dashed #566079; border-radius: 10px; text-align: center; cursor: pointer; background: #111620; }
.dropzone.dragover { border-color: var(--accent-2); background: #152128; }
.dropzone small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; padding: 0 8px; }
.audio-slot { display: grid; grid-template-columns: 29px minmax(0, 1fr); align-items: center; gap: 8px; min-height: 53px; padding: 8px; margin-bottom: 7px; border: 1px dashed #4d5870; border-radius: 9px; background: #101620; cursor: pointer; transition: .16s ease; }
.audio-slot:hover, .audio-slot.dragover { border-color: var(--accent-2); background: #142027; }
.audio-slot.loaded { border-style: solid; border-color: #3c786f; background: #12201f; }
.audio-slot.optional { border-color: #4c5262; }
.audio-slot.optional .slot-number { color: #ffd76b; }
.audio-slot > span:last-child { min-width: 0; }
.audio-slot b, .audio-slot small { display: block; }
.audio-slot b { font-size: 12px; }
.audio-slot small { margin-top: 3px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot-number { color: #bdb5ff; font-weight: 800; text-align: center; }
.arrangement-sequence { display: grid; gap: 7px; }
.sequence-item { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 6px; padding: 8px; border: 1px solid #394359; border-radius: 9px; background: #101620; }
.sequence-item.dragging { opacity: .55; border-color: var(--accent); }
.sequence-order { display: flex; flex-direction: column; gap: 3px; }
.sequence-order button, .sequence-actions button { min-width: 22px; min-height: 22px; padding: 2px 5px; border-radius: 5px; font-size: 10px; }
.sequence-main { min-width: 0; display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 5px; }
.sequence-main input, .sequence-main select { width: 100%; height: 29px; padding: 4px 6px; font-size: 10px; }
.sequence-crossfade { grid-column: 1 / 3; display: grid; grid-template-columns: 88px minmax(0, 1fr); align-items: center; gap: 5px; min-width: 0; color: var(--muted); font-size: 10px; white-space: nowrap; }
.connection-select { position: relative; width: 72px; min-width: 0; justify-self: center; }
.connection-select-trigger { display: grid; place-items: center; width: 100%; min-height: 29px; padding: 4px 6px; border-color: #6255d9; background: #171531; color: #f0edff; font-size: 10px; }
.connection-select-trigger > span { text-align: center; }
.connection-options { position: absolute; z-index: 20; top: calc(100% + 3px); left: 0; right: 0; overflow: hidden; border: 1px solid #7565e8; border-radius: 7px; background: #151a27; box-shadow: 0 8px 18px #0009; }
.connection-option { display: flex; justify-content: center; align-items: center; width: 100%; min-height: 27px; padding: 3px 5px; border: 0; border-radius: 0; background: transparent; color: #e9edff; font-size: 10px; text-align: center; }
.connection-option:hover, .connection-option.selected { background: #42369b; color: #fff; }
.sequence-file { grid-column: 1 / 3; display: flex; align-items: center; gap: 7px; min-width: 0; }
.sequence-file button { flex: 0 0 auto; padding: 5px 8px; font-size: 10px; background: #5146b8; }
.sequence-file small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sequence-actions { display: flex; flex-direction: column; gap: 4px; }
.sequence-add { width: 100%; margin-top: 8px; padding: 7px; border-style: dashed; color: #d6d0ff; font-size: 11px; }
.arrange-options { display: grid; grid-template-columns: 1fr; gap: 7px; align-items: end; margin-top: 10px; }
.arrange-options > #buildArrangementBtn, .arrange-options > .arrangement-timing-copy { width: 100%; }
.arrangement-timing-copy { grid-column: 1; width: 100%; min-height: 30px; padding: 6px 8px; font-size: 10px; }
.arrangement-export-actions { grid-column: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.arrange-options label { color: var(--muted); font-size: 10px; }
.arrange-options select { width: 100%; margin-top: 4px; padding: 7px; }
#downloadArrangementBtn, #downloadArrangementMp3Btn, #applyLyricsBtn, #reflowLyricsBtn { min-height: 30px; padding: 6px 9px; border-radius: 7px; font-size: 11px; }
.microcopy { margin: 8px 1px 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.section-list { display: block; }
.section-picker-label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 10px; }
.section-picker { width: 100%; min-height: 39px; border-color: #46516a; background: #10151e; color: var(--text); font-weight: 700; }
.section-picker:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 2px #7768e52e; }
.section-item { display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 7px; border: 1px solid transparent; border-radius: 9px; padding: 7px; background: #10151e; cursor: pointer; }
.section-item.active { border-color: var(--accent); background: #211d37; }
.section-item.filled .kind { background: #214a45; color: #78e5d9; }
.section-item.last-verse { box-shadow: inset 3px 0 #ffd43b; }
.section-item .section-status { color: var(--muted); font-size: 10px; }
.section-item .kind { font-size: 10px; border-radius: 5px; padding: 4px; text-align: center; background: #2a3040; }
.section-item.chorus .kind { color: #70e6dc; }
.section-item input { min-width: 0; width: 100%; border: 0; background: transparent; color: var(--text); }
.section-item button { border: 0; padding: 3px 6px; background: transparent; color: var(--muted); }
.title-fields { display: grid; gap: 7px; margin-bottom: 9px; }
.title-fields label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 10px; }
.title-fields input { min-width: 0; width: 100%; height: 34px; padding: 6px 9px; font-size: 13px; font-weight: 700; }
.font-type-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; margin: 9px 0 7px; }
.font-type-tabs button { min-width: 0; padding: 6px 3px; font-size: 9px; font-weight: 800; }
.font-type-tabs button.active { border-color: #9b8cff; color: #fff; background: #5146b8; box-shadow: 0 0 0 2px #7768e530; }
.font-settings-panel { padding: 9px; border: 1px solid #343d50; border-radius: 9px; background: #121721; }
.font-settings-panel[hidden] { display: none; }
.caption-layout-section { margin: 9px 0; padding: 9px; border: 1px solid #343d50; border-radius: 9px; background: #121721; }
.caption-layout-grid { display: grid; grid-template-columns: 54px minmax(0, .95fr) minmax(0, .95fr) minmax(0, 1.18fr) minmax(0, .95fr); gap: 5px; align-items: center; }
.caption-layout-grid b { color: #cbd3e3; font-size: 10px; }
.caption-layout-grid .countdown-layout-toggle { min-width: 0; padding: 0; border: 0; border-radius: 0; background: transparent; color: #cbd3e3; font-size: 10px; font-weight: 700; text-align: left; }
.caption-layout-grid .countdown-layout-toggle:hover { color: #e0daff; transform: none; text-decoration: underline; }
.caption-layout-grid .countdown-layout-toggle.active { color: #c9bdff; text-decoration: underline; text-decoration-color: #8b68ff; text-underline-offset: 3px; }
.caption-layout-grid > small { color: var(--muted); font-size: 9px; text-align: center; white-space: nowrap; }
.caption-layout-grid input, .caption-layout-grid select { width: 100%; height: 30px; padding: 4px 6px; font-size: 10px; }
.caption-layout-grid select { padding-left: 7px; padding-right: 4px; }
.caption-layout-grid input[type="number"] { padding: 2px 5px; line-height: 16px; text-align: center; }
.caption-layout-grid input[type="number"]::-webkit-inner-spin-button { height: 16px; transform: scale(.68); transform-origin: right center; }
.caption-layout-grid input[data-layout-rotation] { padding: 4px 3px; text-align: center; }
.style-preset-section { margin: 10px 0; padding: 9px; border: 1px solid #343d50; border-radius: 9px; background: #171a20; }
.style-preset-section .preset-title { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.style-preset-section .preset-title b, .style-preset-section .preset-title small { white-space: nowrap; }
.preset-title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.preset-title b { font-size: 11px; }
.preset-title small { color: var(--muted); font-size: 9px; }
.style-preset-grid { display: grid; grid-template-columns: repeat(5, minmax(38px, 1fr)); gap: 7px; }
.style-preset { min-width: 0; height: 42px; padding: 0; border: 2px solid transparent; border-radius: 9px; background: #303238; color: var(--preset-base); font: 900 22px/1 "Arial Black", "Malgun Gothic", sans-serif; -webkit-text-stroke: var(--preset-outline-width) var(--preset-outline); text-shadow: 0 0 8px var(--preset-glow); box-shadow: inset 0 0 0 1px rgba(255,255,255,.04); }
.style-preset:hover { border-color: #75839a; transform: translateY(-1px); }
.style-preset.selected { border-color: #24d8ee; box-shadow: 0 0 0 1px #24d8ee, inset 0 0 0 1px rgba(255,255,255,.08); }
textarea, select, input[type="number"] { color: var(--text); border: 1px solid var(--border); background: #10141d; border-radius: 8px; }
textarea { width: 100%; resize: vertical; padding: 10px; line-height: 1.6; }
textarea:focus, select:focus, input:focus { outline: 1px solid var(--accent); border-color: var(--accent); }
.row { display: flex; align-items: center; gap: 8px; }
.compact { margin-top: 8px; }
.wide { flex: 1; }
.badge { color: var(--muted); font-size: 11px; }
.lyric-voice-row { justify-content: space-between; }
.lyric-voice-row button { min-height: 32px; }
.lyric-voice-row button.listening { border-color: #ff7285; background: #50212b; color: #ffe8ec; box-shadow: 0 0 0 1px rgba(255,114,133,.26); }
.lyric-voice-help { margin-top: 5px; }
.style-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.style-grid label { display: flex; flex-direction: column; gap: 5px; color: var(--muted); font-size: 11px; }
.style-grid input, .style-grid select { width: 100%; height: 34px; padding: 5px; }
.background-controls label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 10px; }
.background-controls select { padding: 7px; }
.background-controls { display: grid; grid-template-columns: minmax(0, 1fr) 155px; gap: 7px; align-items: end; margin-top: 8px; }
.background-file input { width: 100%; max-width: 100%; color: transparent; font-size: 0; }
.background-file input::file-selector-button { height: 30px; min-height: 30px; margin-right: 7px; padding: 6px 9px; border: 1px solid #9279ff; border-radius: 7px; background: linear-gradient(135deg, #6950e8, #8b68ff); color: #fff; font-size: 11px; font-weight: 800; line-height: 1; cursor: pointer; box-shadow: 0 2px 8px rgba(105,80,232,.28); }
.background-file input::file-selector-button:hover { filter: brightness(1.08); }
.background-dim { grid-column: 1 / 3; display: grid !important; grid-template-columns: 45px minmax(0, 1fr); align-items: center; gap: 7px !important; }
.background-dim input { width: 100%; margin: 0; }
.background-library { margin-top: 9px; padding: 9px; border: 1px solid #343d50; border-radius: 9px; background: #111620; }
.background-library-title { display: grid; grid-template-columns: minmax(0, 1fr); gap: 3px; margin-bottom: 7px; }
.background-library-title b { display: block; font-size: 11px; line-height: 1.25; white-space: nowrap; }
.background-library-title small { display: block; color: var(--muted); font-size: 9px; line-height: 1.35; }
.background-media-list { display: grid; gap: 6px; max-height: 190px; overflow-y: auto; border-radius: 8px; transition: background-color .15s, outline-color .15s; }
.background-media-empty { padding: 12px; border: 1px dashed #46516a; border-radius: 8px; color: var(--muted); font-size: 10px; text-align: center; cursor: pointer; }
.background-media-empty:hover, .background-media-empty:focus-visible { border-color: #8f72ff; color: #eeeaff; background: #211d37; outline: none; }
.background-media-list.file-drag-over { outline: 2px dashed #9b82ff; outline-offset: -2px; background: rgba(111,83,232,.18); }
.background-media-list.file-drag-over .background-media-empty { border-color: transparent; color: #fff; }
.background-media-item { display: grid; grid-template-columns: 48px minmax(0,1fr) 28px; gap: 8px; align-items: center; width: 100%; padding: 6px; text-align: left; }
.background-media-item.selected { border-color: var(--accent); background: #211d37; }
.background-media-item { cursor: grab; }
.background-media-item:active { cursor: grabbing; }
.background-media-item.dragging { opacity: .42; }
.background-media-item.drag-over { outline: 1px dashed #8f72ff; outline-offset: 2px; }
.background-media-thumb { width: 48px; height: 34px; border-radius: 5px; object-fit: cover; background: #252c3a; }
.background-media-info { min-width: 0; }
.background-media-info b, .background-media-info small { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.background-media-info small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.background-media-audio { display: grid; place-items: center; width: 28px; height: 28px; border: 1px solid #3d475b; border-radius: 7px; background: #202735; font-size: 14px; cursor: pointer; }
.background-media-audio.enabled { border-color: #39d0c8; background: #173033; }
.background-media-editor { display: grid; grid-template-columns: 1fr auto; gap: 6px; align-items: end; margin-top: 8px; padding-top: 8px; border-top: 1px solid #343d50; }
.background-media-editor > b { grid-column: 1 / 3; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 10px; }
.background-media-editor label { color: var(--muted); font-size: 9px; }
.background-media-editor input { width: 100%; margin-top: 3px; height: 24px; padding: 2px 5px; line-height: 16px; }
/* Windows/Chrome의 숫자 입력 스피너가 위쪽에서 잘리지 않도록 여백과 높이를 별도로 맞춘다. */
.background-media-editor input[type="number"]::-webkit-inner-spin-button { height: 16px; transform: scale(.72); transform-origin: right center; }
.background-media-editor .danger-soft { grid-column: 1 / 3; color: #fff; border-color: #6b3944; }
#backgroundStartNow, #backgroundEndNow { font-size: 11px; }
input[type="color"] { border: 1px solid var(--border); border-radius: 7px; background: #10141d; }
.preview-card { background: #090c12; overflow: hidden; }
.preview-toolbar { height: 42px; display: flex; gap: 8px; align-items: center; padding: 0 14px; border-bottom: 1px solid var(--border); color: var(--muted); font-size: 12px; }
.preview-toolbar b { color: var(--text); }
.preview-fullscreen-btn { flex: 0 0 auto; margin: 0; padding: 5px 8px; font-size: 10px; white-space: nowrap; }
.preview-aspect, .preview-zoom { display: flex; align-items: center; gap: 5px; font-size: 10px; color: var(--muted); }
.preview-aspect { margin-left: auto; }
.preview-aspect select, .preview-zoom select { height: 26px; padding: 2px 6px; font-size: 11px; }
.preview-card:not(.preview-card-portrait) .preview-zoom { display: none; }
#activeSectionLabel { min-width: 24px; text-align: right; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 8px var(--danger); }
.preview-stage { position: relative; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; background: radial-gradient(circle at 50% 120%, #273048, #121722 70%); }
.preview-stage.preview-portrait { margin-inline: auto; aspect-ratio: 9 / 16; }
/* 가로 25칸 기준의 촘촘한 정사각형 그리드입니다. 세로 백분율은 각 비율에서
   실제 픽셀 폭과 같도록 계산하여 16:9·9:16 모두 네모 칸으로 보이게 합니다. */
.preview-stage.show-grid::after { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; background-image: linear-gradient(to right, rgba(255,255,255,.32) 1px, transparent 1px), linear-gradient(to bottom, rgba(255,255,255,.32) 1px, transparent 1px); background-size: 4% 7.1111%; box-shadow: inset 0 0 0 1px rgba(255,255,255,.42); }
.preview-stage.preview-portrait.show-grid::after { background-size: 4% 2.25%; }
/* 전체 화면에서도 실제 출력 비율을 유지합니다. 16:9는 화면 안을 최대한 채우고,
   9:16은 가운데에 세로 영상으로 표시하여 글자·배치가 왜곡되지 않습니다. */
.preview-fullscreen-host:fullscreen { position: relative; width: 100vw; height: 100dvh; display: grid; place-items: center; background: #000; }
.preview-fullscreen-host:fullscreen .preview-stage { width: min(100vw, 177.7778dvh) !important; max-width: none; aspect-ratio: 16 / 9; }
.preview-fullscreen-host:fullscreen .preview-stage.preview-portrait { width: min(100vw, 56.25dvh) !important; aspect-ratio: 9 / 16; }
/* 전체 화면에서는 재생 제어 막대를 영상 하단에 겹쳐 표시한다. 화면을 나가면
   JavaScript가 원래 편집 위치로 되돌려 놓는다. */
.preview-fullscreen-host:fullscreen .fullscreen-transport { position: absolute; z-index: 20; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: fit-content; max-width: calc(100vw - 32px); margin: 0; box-sizing: border-box; justify-content: center; background: rgba(10, 14, 23, .86); border-color: rgba(174, 190, 224, .5); box-shadow: 0 10px 30px rgba(0, 0, 0, .42); backdrop-filter: blur(8px); }
.preview-fullscreen-host:fullscreen .fullscreen-transport #playAllBtn,
.preview-fullscreen-host:fullscreen .fullscreen-transport .transport-repeat-tools,
.preview-fullscreen-host:fullscreen .fullscreen-transport .transport-volume-tools,
.preview-fullscreen-host:fullscreen .fullscreen-transport #undoBtn,
.preview-fullscreen-host:fullscreen .fullscreen-transport #redoBtn { display: none; }
@media (max-width: 760px) {
  .preview-fullscreen-host:fullscreen .fullscreen-transport { width: calc(100vw - 20px); gap: 5px; padding: 7px 8px; }
  .preview-fullscreen-host:fullscreen .fullscreen-transport .timebox { font-size: 11px; }
}
.preview-background { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.background-overlay { position: absolute; inset: 0; background: rgba(0,0,0,.25); pointer-events: none; }
.safe-area { position: absolute; inset: 8% 5%; border: 1px dashed rgba(255,255,255,.18); pointer-events: none; }
.preview-grid-toggle { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 600; cursor: pointer; }
.preview-grid-toggle input { width: auto; accent-color: var(--accent); }
.karaoke-preview { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 8px; padding: 8% 7% 10%; text-align: center; }
.preview-line { position: absolute; left: 7%; right: 7%; line-height: 1.45; font-weight: 800; text-shadow: 0 3px 7px #000, 0 0 2px #000; letter-spacing: .02em; }
.preview-slot-top { bottom: 25%; }
.preview-slot-bottom { bottom: 9%; }
.preview-line-next { opacity: .96; }
.preview-line-preview { opacity: .96; }
.preview-line.too-long { text-decoration: underline wavy #ff6d78 2px; text-underline-offset: 6px; }
.preview-syllable { position: relative; display: inline-block; isolation: isolate; color: var(--base-color, #f4f6fb); cursor: pointer; -webkit-text-stroke: 0 transparent; }
.preview-syllable.has-preview-outline::before { content: attr(data-outline-text); position: absolute; left: 0; top: 0; z-index: 0; color: var(--preview-outline-color); font: inherit; line-height: inherit; white-space: inherit; -webkit-text-stroke: var(--preview-outline-width) var(--preview-outline-color); pointer-events: none; }
.preview-highlight { position: absolute; inset: 0 auto 0 0; z-index: 2; width: var(--progress, 0%); color: var(--highlight-color, #ffd43b); overflow: hidden; white-space: nowrap; pointer-events: none; font-style: normal; font-family: inherit; font-weight: inherit; }
.preview-countdown { position: absolute; z-index: 4; isolation: isolate; min-width: 1em; color: #fff; -webkit-text-stroke: 0 transparent; text-shadow: none; }
.preview-title { position: absolute; z-index: 4; isolation: isolate; top: 9%; left: 7%; right: 7%; color: #fff; font-weight: 900; text-align: center; -webkit-text-stroke: 0 transparent; text-shadow: none; white-space: pre; overflow: hidden; text-overflow: ellipsis; }
.preview-section-label { position: absolute; z-index: 4; isolation: isolate; left: 7%; right: 7%; bottom: 39%; color: #fff; font-weight: 800; text-align: left; -webkit-text-stroke: 0 transparent; text-shadow: none; }
/* CSS text-stroke는 글자 안쪽까지 덮기 때문에 작은 글자가 검게 보일 수 있습니다.
   외곽선을 먼저 그리고 원래 글자를 위에 채워, 입력한 1이 바깥쪽 1px만 뜻하도록 합니다. */
/* 외곽선 글자를 먼저, 본문 글자를 그 위에 따로 배치합니다. 작은 글자에서
   text-stroke가 본문 안쪽까지 덮는 문제 없이 선명한 기존 표현을 유지합니다. */
.preview-title.has-preview-outline::before, .preview-section-label.has-preview-outline::before, .preview-countdown.has-preview-outline::before { content: attr(data-outline-text); position: absolute; left: 0; top: 0; z-index: 0; color: var(--preview-outline-color); font: inherit; line-height: inherit; white-space: inherit; -webkit-text-stroke: var(--preview-outline-width) var(--preview-outline-color); pointer-events: none; transform: translateZ(0); will-change: transform; }
.preview-caption-fill { display: inline-block; position: relative; z-index: 1; color: inherit; -webkit-text-fill-color: currentColor; transform: translateZ(0); will-change: transform; }
.preview-caption-draggable { cursor: grab; touch-action: none; user-select: none; }
.preview-caption-draggable:active { cursor: grabbing; }
.preview-caption-draggable:hover { overflow: visible !important; }
.preview-rotate-handle { position: absolute; z-index: 9; right: -16px; top: -16px; display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 1px solid #bfa9ff; border-radius: 50%; background: #181329f2; color: #fff; line-height: 1; opacity: 0; pointer-events: none; cursor: grab; transform: rotate(var(--caption-handle-rotation, 0deg)); box-shadow: 0 3px 12px #0009; transition: opacity 110ms ease, transform 110ms ease, background 110ms ease, border-color 110ms ease; }
.preview-rotate-handle svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2.25; }
.preview-rotate-value { position: absolute; top: -20px; left: 50%; padding: 2px 5px; border: 1px solid #5e4a9c; border-radius: 5px; background: #141020ed; color: #e8deff; font-size: 9px; font-weight: 700; line-height: 1; opacity: 0; pointer-events: none; transform: translateX(-50%); transition: opacity 110ms ease; }
.preview-caption-draggable:hover .preview-rotate-handle, .preview-rotate-handle:focus { opacity: 1; pointer-events: auto; }
.preview-caption-draggable:hover .preview-rotate-handle { transform: rotate(var(--caption-handle-rotation, 0deg)) scale(1); }
.preview-rotate-handle:hover, .preview-rotate-handle:focus-visible { border-color: #fff; background: #7350ed; outline: none; }
.preview-rotate-handle:hover .preview-rotate-value, .preview-rotate-handle:focus .preview-rotate-value { opacity: 1; }
.preview-rotate-handle:active { cursor: grabbing; background: #8a68ff; }
.preview-placeholder { color: #697487; font-size: 14px; }
.mp4-export { display: grid; grid-template-columns: minmax(120px, 1fr) 145px 165px 145px 135px auto; gap: 8px; align-items: end; margin: 12px 0; padding: 10px 12px; }
.mp4-export[hidden] { display: none; }
.mp4-export-title { align-self: center; }
.mp4-export-title b, .mp4-export-title small { display: block; }
.mp4-export-title b { font-size: 12px; }
.mp4-export-title small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.mp4-export label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 10px; }
.mp4-export select { height: 30px; padding: 4px 7px; }
.mp4-export button { height: 30px; }
.mp4-destination { grid-column: 1 / 7; display: grid; grid-template-columns: minmax(260px, 1fr) auto; gap: 8px; align-items: end; padding-top: 2px; }
.mp4-destination label { min-width: 0; }
.mp4-filename { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; height: 30px; border: 1px solid var(--border); border-radius: 7px; overflow: hidden; background: #10141d; }
.mp4-filename:focus-within { outline: 1px solid var(--accent); border-color: var(--accent); }
.mp4-filename input { min-width: 0; width: 100%; height: 100%; padding: 4px 8px; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 11px; }
.mp4-filename i { padding: 0 8px 0 3px; color: var(--muted); font-size: 10px; font-style: normal; }
.export-location-choice { display: flex; align-items: center; gap: 10px; min-width: 0; }
.export-location-choice > span { color: var(--muted); font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp4-destination #chooseExportLocationBtn { flex: 0 0 auto; min-width: 132px; display: grid; place-items: center; padding: 0 12px; text-align: center; font-size: 11px; }
.mp4-destination button.active { border-color: var(--accent-2); color: #80efe7; background: #173033; }
.mp4-export progress { grid-column: 1 / 7; width: 100%; height: 8px; accent-color: var(--accent); }
.mp4-export > span { grid-column: 1 / 7; color: var(--muted); font-size: 10px; }
.mp4-export.exporting > span { color: #d9d3ff; }
.transport { min-height: 62px; display: flex; align-items: center; gap: 6px; margin: 12px 0; padding: 10px 8px; overflow: hidden; }
.transport > * { flex-shrink: 0; }
.play-btn { flex: 0 0 42px; width: 42px; height: 42px; padding: 0; border-radius: 50%; background: var(--text); color: #141824; font-size: 17px; display: grid; place-items: center; line-height: 1; }
/* ▶ 문자는 글꼴의 보이지 않는 오른쪽 여백 때문에 수학적 중심보다 왼쪽에 보입니다.
   재생 아이콘만 1px 보정하고, 일시정지 기호는 정확한 가운데를 유지합니다. */
.play-btn .play-icon { display: block; line-height: 1; transform: translateX(1px); }
.play-btn.is-playing .play-icon { transform: none; }
.timebox { flex: 0 0 108px; min-width: 108px; display: flex; flex-direction: column; gap: 1px; align-items: flex-start; margin: 0 0 0 8px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.timebox-total { display: flex; gap: 5px; color: var(--muted); font-size: 12px; }
.timebox-total i { font-style: normal; }
.rate-label { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; margin: 0 0 0 -36px; height: 30px; padding: 0 9px; border: 1px solid var(--accent); border-radius: 7px; background: linear-gradient(135deg, #6950e8, #8b68ff); color: #fff; font-size: 11px; font-weight: 650; white-space: nowrap; }
.rate-label select { height: 22px; padding: 1px 5px; margin: 0; border-color: rgba(255,255,255,.32); background: rgba(21,17,48,.42); color: #fff; }
#playAllBtn, .transport-action { height: 30px; padding: 0 10px; font-size: 11px; }
.transport-volume-tools { flex: 0 0 auto; display: flex; align-items: center; gap: 4px; margin-left: 2px; }
.transport-repeat-tools { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; margin-left: 5px; }
.toggle.active { color: #80efe7; border-color: var(--accent-2); background: #173033; }
.loop-range { min-width: 60px; color: var(--muted); font-size: 9px; line-height: 1.15; white-space: pre-line; font-variant-numeric: tabular-nums; }
.export-actions { display: flex; gap: 8px; align-items: center; }
.export-actions > button { display: inline-flex; align-items: center; justify-content: center; height: 30px; text-align: center; font-size: 11px; }
.export-actions > button[hidden] { display: none; }
.export-actions > button.danger { color: #fff0f1; border-color: #b75563; background: #7b3340; }
.waveform-card { min-height: 207px; position: relative; overflow: hidden; background: #10151e; padding: 0; }
.waveform-toolbar { height: 39px; display: flex; align-items: center; gap: 9px; padding: 0 11px; border-bottom: 1px solid #303849; color: #dfe5f5; font-size: 11px; }
.waveform-toolbar span { color: var(--muted); font-size: 10px; margin-right: auto; }
.waveform-toolbar label { display: flex; align-items: center; gap: 5px; color: var(--muted); white-space: nowrap; }
.waveform-zoom { display: flex; align-items: center; gap: 5px; }
.waveform-edit-tools { display: flex; align-items: center; gap: 9px; margin-left: auto; white-space: nowrap; }
.waveform-edit-tools > #stretchSelectionBtn { order: 1; }
.waveform-edit-tools > .stretch-control { order: 2; }
.waveform-edit-tools > #trimStartBtn { order: 3; }
.waveform-edit-tools > #trimArrangementBtn { order: 4; }
.waveform-edit-tools > #removeSelectionBtn { order: 5; }
.waveform-edit-tools > #copySelectionBtn { order: 6; }
.waveform-edit-tools > #pasteSelectionBtn { order: 7; }
.waveform-zoom button { width: 24px; height: 24px; padding: 0; border-radius: 6px; font-size: 16px; line-height: 1; }
.waveform-zoom input { width: 120px; accent-color: var(--accent); cursor: ew-resize; }
.waveform-toolbar output { min-width: 24px; color: #d8d1ff; font-variant-numeric: tabular-nums; }
.stretch-control { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 10px; white-space: nowrap; }
.stretch-control b { font-size: 10px; font-weight: 600; }
.stretch-control button { width: 24px; height: 24px; padding: 0; border-radius: 6px; font-size: 16px; line-height: 1; }
.stretch-control input[type="range"] { width: 172px; accent-color: var(--accent); cursor: ew-resize; }
.stretch-factor-entry { gap: 3px; }
.stretch-factor-entry input { width: 58px; min-height: 24px; padding: 2px 4px; font: inherit; font-variant-numeric: tabular-nums; }
.stretch-control output { min-width: 34px; }
.volume-control { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 10px; white-space: nowrap; }
.volume-control button { width: 24px; height: 24px; padding: 0; border-radius: 6px; font-size: 16px; line-height: 1; }
.volume-control input { width: 60px; accent-color: #30c979; cursor: ew-resize; }
.volume-control output { min-width: 30px; }
.waveform-viewport { height: 132px; overflow-x: auto; overflow-y: hidden; background: #10151e; }
.wave-section-nav-row { min-height: 33px; display: flex; align-items: center; gap: 8px; padding: 4px 10px; border-top: 1px solid #303849; background: #0e1219; }
.wave-section-nav { display: flex; align-items: center; gap: 5px; min-width: 0; overflow-x: auto; scrollbar-width: thin; }
.wave-section-nav button { display: inline-flex; align-items: center; justify-content: center; min-width: 42px; height: 24px; padding: 0 8px; border-radius: 5px; color: #dce5f7; font-size: 10px; line-height: 1; white-space: nowrap; }
.wave-section-nav button.active { color: #fff2c8; border-color: #e2af42; background: #513a14; }
#playSelectedSectionBtn { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; height: 24px; padding: 0 9px; font-size: 10px; line-height: 1; white-space: nowrap; }
.wave-section-shortcut { min-width: 0; color: #9ba8bd; font-size: 10px; line-height: 1.25; }
.waveform-canvas-wrap { position: relative; width: 100%; min-width: 100%; height: 132px; }
#waveform { width: 100%; height: 132px; display: block; cursor: crosshair; touch-action: none; user-select: none; }
.waveform-card.scrubbing #waveform { cursor: ew-resize; }
  .wave-measure-markers { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.wave-section-labels, .wave-measure-labels { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
.wave-section-label { position: absolute; top: 3px; transform: translateX(-50%); overflow: hidden; padding: 1px 6px; border: 1px solid #c3973a; border-radius: 4px; background: rgba(48,34,13,.9); color: #ffe2a0; font-size: 9px; font-weight: 800; line-height: 14px; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.wave-section-label.start { transform: translateX(0); }
.wave-section-label.end { transform: translateX(-100%); }
.wave-measure-label { position: absolute; top: 23px; transform: translateX(-50%); min-width: 16px; padding: 1px 3px; border: 1px solid #64708a; border-radius: 4px; background: rgba(11,14,20,.82); color: #dbe3f5; font-size: 9px; line-height: 14px; text-align: center; font-variant-numeric: tabular-nums; white-space: nowrap; }
.wave-measure-marker { position: absolute; top: 0; bottom: 0; width: 9px; margin-left: -4.5px; background: transparent; pointer-events: auto; cursor: context-menu; }
.wave-measure-marker::after { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 1px; margin-left: -.5px; background: #39d0c8; opacity: 1; box-shadow: none; }
.wave-first-lyric-marker { position: absolute; z-index: 4; top: 0; bottom: 0; width: 11px; margin-left: -5px; cursor: ew-resize; pointer-events: auto; touch-action: none; }
.wave-first-lyric-marker::after { content: ""; position: absolute; top: 0; bottom: 0; left: 5px; border-left: 2px dashed #ffb64d; }
.wave-section-marker { position: absolute; z-index: 2; top: 0; bottom: 0; width: 1px; margin-left: -.5px; background: #f4b942; pointer-events: none; }
.wave-section-marker.draggable { width: 9px; margin-left: -4.5px; background: transparent; pointer-events: auto; cursor: ew-resize; touch-action: none; }
.wave-section-marker.draggable::after { content: ""; position: absolute; top: 0; bottom: 0; left: 4px; width: 1px; background: #f4b942; }
.wave-cursor, .playhead { position: absolute; top: 0; bottom: 0; width: 1px; margin-left: -.5px; background: #ff5d78; pointer-events: none; z-index: 5; }
.wave-cursor-time { position: absolute; top: 3px; z-index: 6; transform: translateX(-50%); padding: 1px 4px; border: 1px solid #ff7990; border-radius: 4px; background: #24131a; color: #ffd8df; font-size: 9px; line-height: 14px; font-variant-numeric: tabular-nums; pointer-events: none; white-space: nowrap; }
.loop-shade { position: absolute; top: 0; bottom: 0; display: none; background: rgba(57, 208, 200, .12); border-left: 1px solid #39d0c8; border-right: 1px solid #39d0c8; pointer-events: none; }
.cut-shade { position: absolute; top: 0; bottom: 0; display: none; background: linear-gradient(90deg, rgba(82, 181, 255, .30), rgba(82, 181, 255, .18)); border-left: 2px solid #67c7ff; border-right: 2px solid #67c7ff; box-shadow: inset 0 0 0 1px rgba(151, 218, 255, .22), 0 0 10px rgba(82, 181, 255, .24); pointer-events: none; z-index: 4; }
.wave-empty { position: absolute; inset: 0; display: grid; place-items: center; color: #697487; font-size: 13px; pointer-events: none; }
.timing-card { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.timing-card > .layer-editor, .timing-card > .measure-sync-card, .timing-card > .rhythm-editor { grid-column: 1; }
.measure-sync-card { margin-top: 0; padding: 11px; min-width: 0; border: 1px solid #3a4357; border-radius: 9px; background: #0f141d; }
.timing-card > .rhythm-editor { min-width: 0; margin-top: 0; }
.timing-card > .layer-editor { margin-top: 0; }
.timing-card > .timing-head, .timing-card > .line-sync-editor, .timing-card > .timeline-scroll, .timing-card > .selection-editor { display: none; }
.measure-sync-title { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 8px; margin-bottom: 9px; }
.measure-sync-title > b { margin-right: 0; }
.measure-sync-title span { margin-right: auto; margin-bottom: 1px; color: var(--muted); font-size: 10px; white-space: nowrap; }
.measure-sync-rest-controls { display: inline-flex; align-items: flex-end; gap: 5px; }
.measure-sync-title .compact { padding: 6px 9px; white-space: nowrap; }
.measure-sync-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(245px, 1fr)); gap: 8px; }
.measure-sync-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: start; gap: 4px; padding: 6px; border: 1px solid #343e52; border-radius: 6px; background: #101620; }
.measure-sync-row.selected { border-color: var(--accent); background: #211d37; }
.measure-sync-row.wave-hovered { border-color: #39d0c8; background: #10232a; box-shadow: 0 0 0 1px rgba(57,208,200,.26), 0 0 12px rgba(57,208,200,.14); }
.measure-sync-row label { color: var(--muted); font-size: 9px; }
.measure-sync-row input { width: 100%; min-width: 0; height: 25px; margin-top: 2px; padding: 2px 4px; font-size: 9px; line-height: 18px; }
.measure-sync-row input[type="number"]::-webkit-inner-spin-button { height: 18px; transform: scale(.82); transform-origin: right center; }
.measure-sync-row button { min-height: 23px; padding: 3px 6px; border-radius: 4px; font-size: 9px; white-space: nowrap; }
.measure-sync-row .measure-sync-lyric { grid-column: 1; overflow: hidden; min-height: 24px; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.measure-sync-row [data-action="fit"] { grid-column: 2; grid-row: 1; width: auto; }
.measure-field { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; align-items: center; gap: 3px; }
.measure-field span { width: 24px; }
.measure-field [data-action="now"] { min-height: 21px; min-width: 0; padding: 2px 3px; font-size: 8px; color: #c9c2ff; }
.measure-field:nth-of-type(1) { grid-column: 1; }
.measure-field:nth-of-type(2) { grid-column: 2; }
.measure-first-lyric { grid-column: 1 / -1; display: flex; align-items: end; gap: 4px; }
.measure-first-lyric label { flex: 1; min-width: 0; color: #ffc46d; }
.timing-card { margin-top: 12px; padding: 14px; }
.layer-editor { margin: 0 0 12px; padding: 10px; border: 1px solid #3a4357; border-radius: 10px; background: #0f141d; }
  .layer-editor-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.layer-editor-head > div { display: flex; align-items: flex-end; gap: 8px; margin-right: auto; }
.layer-editor-head > div span { margin-bottom: 1px; white-space: nowrap; }
.layer-editor-head span { color: var(--muted); font-size: 10px; }
.layer-editor-head .layer-zoom-control { align-items: center; gap: 5px; margin-right: 0; }
.layer-zoom-control > span { margin: 0; color: #b9c2d2; font-size: 10px; }
.layer-zoom-control button { width: 25px; min-width: 25px; height: 25px; min-height: 25px; padding: 0; font-size: 17px; line-height: 20px; }
.layer-zoom-control input { width: 92px; accent-color: var(--accent); }
.layer-zoom-control output { min-width: 34px; color: #d7d0ff; font-size: 10px; font-variant-numeric: tabular-nums; text-align: right; }
.layer-editor-head .compact { flex: 0 0 auto; padding: 7px 10px; white-space: nowrap; }
.layer-editor-head .badge.warning { color: #ffd099; border-color: #8c6134; background: #302318; }
.layer-layout { display: grid; grid-template-columns: 96px minmax(0, 1fr); border: 1px solid #303849; border-radius: 8px; overflow: hidden; }
.layer-labels { padding-top: 25px; background: #141a24; border-right: 1px solid #303849; }
.layer-label { height: 30px; display: flex; align-items: center; gap: 6px; padding: 0 8px; border-bottom: 1px solid #242c3a; color: #abb5c7; font-size: 10px; white-space: nowrap; }
.layer-label i { width: 7px; height: 7px; border-radius: 50%; background: var(--layer-color, #68748a); }
.layer-scroll { overflow-x: auto; overflow-y: hidden; background: #0b0f16; }
.layer-canvas { position: relative; min-width: 100%; height: 235px; cursor: crosshair; touch-action: none; user-select: none; }
.layer-canvas.scrubbing { cursor: ew-resize; }
.layer-ruler { position: relative; height: 25px; border-bottom: 1px solid #303849; }
.layer-ruler .tick-label { top: 2px; }
.layer-rows { position: absolute; top: 25px; left: 0; right: 0; }
.layer-row { position: relative; height: 30px; border-bottom: 1px solid #242c3a; background-image: linear-gradient(90deg, transparent 99%, rgba(255,255,255,.025) 100%); }
.layer-clip { position: absolute; top: 3px; height: 24px; min-width: 8px; padding: 0 3px; border: 1px solid var(--clip-color); border-radius: 5px; overflow: hidden; background: color-mix(in srgb, var(--clip-color) 68%, #111); color: #f4f7fb; line-height: 22px; text-overflow: clip; white-space: pre; cursor: pointer; }
.layer-clip:hover { filter: brightness(1.22); outline: 1px solid rgba(255,255,255,.35); }
.layer-clip.resizable { padding-left: 7px; padding-right: 7px; }
.layer-resize-handle { position: absolute; z-index: 2; top: 0; bottom: 0; width: 7px; cursor: ew-resize; touch-action: none; }
.layer-resize-handle::after { content: ""; position: absolute; top: 5px; bottom: 5px; width: 2px; border-radius: 2px; background: rgba(255,255,255,.88); opacity: .3; }
.layer-clip.resizable:hover .layer-resize-handle::after { opacity: .95; }
.layer-resize-handle.start { left: 0; }
.layer-resize-handle.end { right: 0; }
.layer-resize-handle.start::after { left: 2px; }
.layer-resize-handle.end::after { right: 2px; }
#buildArrangementBtn.building { cursor: progress; filter: saturate(.75); }
.layer-playhead { position: absolute; z-index: 8; top: 0; bottom: 0; width: 2px; background: #fff; box-shadow: 0 0 0 1px #111; pointer-events: auto; cursor: ew-resize; }
.layer-playhead::before { content: ""; position: absolute; top: 0; bottom: 0; left: -7px; width: 16px; }
.timing-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.timing-head h2 { margin: 0; font-size: 15px; }
.timing-head p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
kbd { background: #2e3544; border: 1px solid #4a5365; border-radius: 4px; padding: 1px 5px; }
.timing-actions { display: flex; align-items: center; gap: 7px; font-size: 11px; }
.timing-actions select { padding: 7px; }
.timing-actions input { vertical-align: middle; }
.record-status { margin: 12px 0 7px; padding: 7px 10px; border-radius: 7px; background: #10151e; color: var(--muted); font-size: 11px; }
.record-status.recording { color: #ff9aac; background: #2a1720; }
.line-sync-editor { margin: 10px 0; padding: 10px; border: 1px solid #394359; border-radius: 9px; background: #10151e; }
.line-sync-head { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; font-size: 10px; }
.line-sync-head > span { margin-right: auto; color: var(--muted); }
.rest-only-part-select { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); white-space: nowrap; }
.rest-only-part-select select { max-width: 112px; height: 29px; padding: 4px; }
.line-list { display: flex; gap: 6px; overflow-x: auto; padding: 9px 0 5px; }
.line-chip { min-width: 190px; max-width: 300px; padding: 8px; border: 1px solid #394359; border-radius: 8px; background: #171d29; color: var(--text); text-align: left; }
.line-chip.selected { border-color: #e2c95c; outline: 1px solid #e2c95c; background: #332f1b; }
.line-chip b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.line-chip small { display: block; margin-top: 4px; color: var(--muted); }
.line-fit-status { margin-top: 6px; color: #98a4b8; font-size: 10px; }
.line-fit-status.warning { color: #ff9d79; }
.rhythm-editor { margin: 0; padding: 14px; border: 1px solid #3b4560; border-radius: 10px; background: linear-gradient(180deg, #151b29, #111621); }
.rhythm-title { display: flex; align-items: center; gap: 8px; padding-bottom: 10px; border-bottom: 1px solid #30394d; }
.rhythm-title > div { display: flex; align-items: baseline; gap: 10px; margin-right: auto; }
.rhythm-title span { color: var(--muted); font-size: 10px; }
.rhythm-settings { display: grid; grid-template-columns: minmax(180px, 240px); gap: 8px; align-items: end; padding: 10px 0; }
.rhythm-settings label, .note-toolbar label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 10px; white-space: nowrap; }
.rhythm-settings input, .rhythm-settings select { width: 100%; height: 30px; padding: 5px 7px; }
.rhythm-settings button { height: 30px; }
.lyrics-unit-mode { display: inline-flex; align-items: center; gap: 5px; min-height: 30px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.lyrics-unit-mode input { margin: 0; accent-color: #d6be4e; }
.note-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 2px; padding: 9px; border: 1px solid #30394d; border-radius: 8px; background: #101520; }
.note-toolbar .beat-unit-selector { width: 130px; flex: 0 0 130px; }
.note-toolbar .beat-unit-selector select { width: 100%; margin-left: 0; }
.note-toolbar > button { min-width: 70px; padding: 7px 8px; font-size: 11px; }
.note-toolbar > button.note-choice { display: inline-flex; align-items: center; justify-content: center; min-width: 50px; width: 50px; height: 43px; padding: 3px; }
.note-toolbar > button.note-append-btn { min-width: 30px; width: 30px; height: 30px; padding: 0; border-radius: 7px; font-size: 20px; font-weight: 800; line-height: 1; }
.note-toolbar > button.triplet-choice { min-width: 54px; height: 43px; padding: 3px 7px; color: #ffffff; font-size: 12px; font-weight: 800; }
#applyNoteBtn { display: inline-flex; flex: 0 0 54px; align-items: center; justify-content: center; flex-direction: column; min-width: 54px; width: 54px; height: 40px; margin-left: 8px; padding: 3px 2px; font-size: 10px; line-height: 1.12; white-space: nowrap; }
#applyNoteBtn span + span { margin-top: 2px; }
.note-glyph { display: inline-block; color: #ffffff; font-family: "Segoe UI Symbol", "Noto Music", serif; font-size: 34px; font-weight: 400; font-synthesis: none; line-height: .9; text-rendering: geometricPrecision; }
.note-dot { display: inline-block; color: #ffffff; font-family: "Segoe UI Symbol", "Noto Music", serif; font-size: 23px; font-weight: 400; font-synthesis: none; line-height: 1; text-rendering: geometricPrecision; transform: translate(-1px, 6px); }
.triplet-mark { display: inline-block; margin-left: 1px; color: #8ee6ff; font-size: 12px; font-weight: 900; line-height: 1; transform: translateY(-9px); }
.note-toolbar button.active { color: #fff4a8; border-color: #d6be4e; background: #423a19; }
.note-toolbar select { padding: 6px; margin-left: 3px; }
#noteMultiplier { width: 82px; height: 32px; padding: 5px 7px; font-variant-numeric: tabular-nums; }
.note-toolbar .rest-select { display: grid; grid-template-columns: minmax(0, 1fr) 25px; grid-template-rows: auto 32px; align-items: center; min-width: 142px; text-align: center; }
.note-toolbar .rest-select > span { grid-column: 1 / -1; }
.note-toolbar .rest-select select { grid-column: 1; grid-row: 2; width: 100%; height: 32px; margin-left: 0; font-family: "Segoe UI Symbol", "Noto Music", "Malgun Gothic", sans-serif; font-size: 15px; font-weight: 600; line-height: 1; text-align: center; text-align-last: center; }
.rest-append-btn { grid-column: 2; grid-row: 2; width: 24px; height: 32px; padding: 0; border-radius: 6px; font-size: 18px; line-height: 1; }
.note-toolbar .accent { margin-left: auto; }
#applyNoteBtn.accent { margin-left: 8px; }
.rhythm-syllables { display: flex; gap: 5px; overflow-x: auto; padding: 8px 1px 4px; min-height: 65px; }
.rhythm-chip { width: 62px; min-width: 62px; min-height: 59px; padding: 5px 4px; border: 1px solid #394257; border-radius: 7px; background: #191f2c; color: #f3f6fc; text-align: center; cursor: pointer; }
.rhythm-chip:focus-visible { outline: 2px solid #8ee6ff; outline-offset: 2px; }
.rhythm-chip-main { display: flex; align-items: center; justify-content: center; gap: 4px; min-height: 27px; }
.rhythm-chip b { overflow: hidden; max-width: 20px; font-size: 16px; line-height: 1; text-overflow: ellipsis; white-space: nowrap; }
.rhythm-chip.grouped-lyrics { width: auto; min-width: 78px; max-width: 240px; }
.rhythm-chip.grouped-lyrics b { max-width: 180px; }
.rhythm-chip-note { display: inline-flex; align-items: center; color: #f8fafc; line-height: 1; white-space: nowrap; }
.rhythm-chip.compound { width: auto; min-width: 82px; }
.rhythm-chip-note .note-plus { display: inline-block; margin: 0 1px; color: #aeb8ca; font-size: 13px; font-weight: 700; line-height: 1; }
.rhythm-chip-note .note-glyph { font-size: 29px; }
.rhythm-chip-note .note-dot { font-size: 19px; transform: translate(-1px, 5px); }
.rhythm-chip-note .triplet-mark { font-size: 11px; transform: translate(-1px, -9px); }
.rhythm-chip.tuplet-member { border-top-color: #8ee6ff; border-top-width: 2px; }
.rhythm-chip.tuplet-start { border-top-right-radius: 0; }
.rhythm-chip.tuplet-end { border-top-left-radius: 0; }
.tuplet-group-label { display: inline-flex; align-items: center; justify-content: center; min-width: 14px; height: 14px; margin-left: 1px; border-radius: 8px; background: #17728d; color: #fff; font-size: 10px; font-weight: 900; line-height: 1; transform: translateY(-12px); }
.rhythm-chip small { display: block; margin-top: 3px; color: #aeb8ca; font-size: 10px; line-height: 1.1; }
.rhythm-chip .rhythm-chip-multiplier { color: #c7d0df; font-weight: 700; }
.rhythm-chip .rhythm-chip-rest { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 4px; color: #8e9aaf; font-size: 8px; line-height: 1.25; }
.rhythm-rest-group, .rhythm-rest-item { display: inline-flex; align-items: center; gap: 1px; white-space: nowrap; }
.rhythm-rest-remove { width: 12px; min-width: 12px; height: 12px; margin: 0; padding: 0; border: 0; border-radius: 50%; background: #4a5262; color: #f4f7fb; font-size: 11px; font-weight: 800; line-height: 11px; cursor: pointer; }
.rhythm-rest-remove:hover, .rhythm-rest-remove:focus-visible { background: #b85c5c; outline: none; }
.rhythm-chip.selected { border-color: #e2c95c; outline: 1px solid #e2c95c; background: #37311a; }
.rhythm-empty { color: #697487; font-size: 11px; align-self: center; }
.timeline-scroll { overflow-x: auto; overflow-y: hidden; border: 1px solid var(--border); border-radius: 9px; background: #0e1219; }
.timeline { position: relative; min-width: 100%; height: 146px; }
.ruler { height: 31px; position: relative; border-bottom: 1px solid var(--border); }
.tick { position: absolute; bottom: 0; width: 1px; height: 7px; background: #4d5669; }
.tick.major { height: 13px; }
.tick-label { position: absolute; top: 3px; left: 4px; color: #747f91; font-size: 9px; white-space: nowrap; }
.syllable-track { position: absolute; left: 0; right: 0; top: 31px; bottom: 0; }
.syllable-bar { position: absolute; top: 30px; height: 48px; min-width: 5px; border: 1px solid #6e61ba; border-radius: 7px; background: linear-gradient(180deg, #443b73, #2b2850); cursor: grab; user-select: none; overflow: visible; }
.syllable-bar:nth-child(even) { top: 34px; background: linear-gradient(180deg, #355d66, #203d46); border-color: #4b8992; }
.syllable-bar.selected { outline: 2px solid #e8dc74; z-index: 3; }
.syllable-bar.record-next { outline: 2px solid var(--danger); animation: pulse 1s infinite; }
.syllable-bar .label { position: absolute; inset: 0; display: grid; place-items: center; overflow: hidden; font-size: 12px; font-weight: 700; pointer-events: none; }
.handle { position: absolute; top: 0; width: 7px; height: 100%; cursor: ew-resize; z-index: 2; }
.handle.left { left: -3px; }.handle.right { right: -3px; }
.selection-editor { height: 43px; display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 11px; }
.selection-editor > span:first-child { min-width: 135px; color: var(--text); font-weight: 700; }
.selection-editor input { width: 82px; height: 28px; padding: 4px 5px; line-height: 18px; }
.selection-editor input[type="number"]::-webkit-inner-spin-button { height: 19px; transform: scale(.82); transform-origin: right center; }
.hint { margin-left: auto; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 100; background: #edf0f7; color: #151923; border-radius: 9px; padding: 11px 15px; box-shadow: 0 10px 30px #0008; opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: translateY(0); }
.confirm-popover { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; background: #05070a88; }
.confirm-popover[hidden] { display: none; }
.confirm-popover-card { width: min(365px, calc(100vw - 40px)); padding: 17px 18px 13px; border: 1px solid #58627a; border-radius: 12px; background: #171d2a; box-shadow: 0 18px 48px #000a; }
.confirm-popover-card p { margin: 0; color: #f1f4fb; font-size: 13px; line-height: 1.55; font-weight: 700; }
.confirm-popover-card p span { display: block; white-space: nowrap; }
.confirm-popover-actions { display: flex; justify-content: flex-end; gap: 7px; margin-top: 13px; }
.confirm-popover-actions button { min-height: 27px; min-width: 42px; padding: 4px 9px; font-size: 11px; }
.manual-dialog { position: fixed; inset: 0; z-index: 121; display: grid; place-items: center; padding: 22px; background: #05070aa8; }
.manual-dialog[hidden] { display: none; }
.manual-dialog-card { width: min(720px, calc(100vw - 44px)); max-height: min(760px, calc(100vh - 44px)); display: flex; flex-direction: column; overflow: hidden; border: 1px solid #58627a; border-radius: 13px; background: #171d2a; box-shadow: 0 20px 56px #000b; }
.manual-dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 16px 18px 13px; border-bottom: 1px solid #343d50; }
.manual-dialog-header b, .manual-dialog-header small { display: block; }
.manual-dialog-header b { color: #f4f6fb; font-size: 16px; }
.manual-dialog-header small { margin-top: 4px; color: var(--muted); font-size: 11px; }
.manual-close-btn { min-width: 31px; padding: 5px 8px; font-size: 14px; }
.manual-dialog-body { overflow: auto; padding: 16px 20px 19px; color: #dce2ef; font-size: 13px; line-height: 1.65; }
.manual-dialog-body section + section { margin-top: 17px; }
.manual-dialog-body h3 { margin: 0 0 6px; color: #c9bdff; font-size: 14px; }
.manual-dialog-body p { margin: 0; }
.manual-dialog-body ol { margin: 0; padding-left: 22px; }
.manual-dialog-body li + li { margin-top: 4px; }
.manual-dialog-body details { margin-top: 10px; border: 1px solid #3d4760; border-radius: 8px; background: #111723; }
.manual-dialog-body summary { cursor: pointer; padding: 10px 12px; color: #e3ddff; font-size: 14px; font-weight: 700; }
.manual-dialog-body summary:focus-visible { outline: 2px solid #b6a9ff; outline-offset: -3px; border-radius: 8px; }
.manual-dialog-body details[open] summary { border-bottom: 1px solid #343d50; }
.manual-dialog-body details p, .manual-dialog-body details ol { margin: 10px 13px; }
.manual-dialog-body details ol { padding-left: 22px; }
.manual-dialog-body b { color: #f4f6fb; }
.manual-dialog-body .manual-example { margin: 12px; padding: 2px 12px 8px; border-left: 3px solid #a799ff; border-radius: 4px; background: #20283a; }
.manual-dialog-body .manual-example h4 { margin: 12px 0 6px; color: #d7ceff; font-size: 13px; }
.manual-dialog-body .manual-example p, .manual-dialog-body .manual-example ol { margin: 8px 0; }
.manual-dialog-body .manual-example ol { padding-left: 22px; }
.manual-figure { margin: 12px; padding: 8px; border: 1px solid #46536c; border-radius: 8px; background: #111824; }
.manual-figure svg { display: block; width: 100%; height: auto; }
.manual-figure figcaption { margin: 6px 4px 2px; color: #b9c8db; font-size: 11px; line-height: 1.5; }
.manual-note { margin: 20px 0 0 !important; padding: 10px 12px; border: 1px solid #3d4760; border-radius: 8px; color: #aeb9cc; background: #10151f; font-size: 11px; }
@keyframes pulse { 50% { box-shadow: 0 0 12px var(--danger); } }
@media (max-height: 800px) {
  .preview-stage {
    width: min(100%, 586.667px);
    max-height: none;
    margin-inline: auto;
  }
}

/* Keep synchronization controls reachable when the window or browser zoom changes. */
.transport, .waveform-toolbar, .waveform-edit-tools,
.measure-sync-title, .layer-editor-head, .layer-editor-head > div,
.rhythm-title, .rhythm-title > div, .wave-section-nav-row { flex-wrap: wrap; }
.waveform-toolbar { height: auto; min-height: 39px; padding-block: 7px; }
.timing-card > .layer-editor { min-width: 0; }
.measure-sync-title span, .layer-editor-head > div span { white-space: normal; }
.topbar { height: auto; min-height: 66px; flex-wrap: wrap; padding-block: 10px; gap: 10px; }
.top-actions { flex-wrap: wrap; }
body { display: flex; flex-direction: column; }
.workspace { flex: 1; min-height: 0; height: auto; }
.mp4-export { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.mp4-destination, .mp4-export progress, .mp4-export > span { grid-column: 1 / -1; }
.mp4-destination { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
@media (max-width: 1180px) {
  .workspace { grid-template-columns: 290px minmax(0, 1fr); }
  .editor { padding: 10px; }
  .rate-label { margin-left: 0; }
  .preview-layout { grid-template-columns: 1fr; }
  .timing-card { grid-template-columns: 1fr; }
  .measure-sync-card, .timing-card > .rhythm-editor, .timing-card > .layer-editor { grid-column: 1; grid-row: auto; }
}
@media (max-width: 700px) {
  body { height: auto; min-height: 100%; }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--border); }
  .preview-toolbar { height: auto; min-height: 42px; flex-wrap: wrap; padding-block: 8px; }
  .measure-sync-list { grid-template-columns: minmax(0, 1fr); }
}
