/* 谱面优先；编辑内容保持稳定宽度，分栏与浮窗共用面板样式。 */
.editor-v2 .editor-workspace{
  grid-template-columns:minmax(0,1fr) clamp(380px,32vw,440px);
  gap:18px;padding-inline:clamp(20px,3vw,48px);
  max-width:1700px;margin-inline:auto;
}
.editor-v2 .score-side{padding-right:0}
.editor-v2 .paper-scroll,.editor-v2 .library-side{
  border:1px solid #dfe2de;border-radius:10px;
  box-shadow:0 4px 18px #173c3009;
}
.editor-v2 .library-side{display:block}
.editor-v2 .composition-paper{padding-inline:26px;container-type:inline-size}
.selection-tools{flex-wrap:wrap;row-gap:8px}
.selection-tools>div:first-child{min-width:150px}
.history-actions{flex-wrap:wrap}
.idle-page{padding:32px 24px}
.idle-page h2{font-size:22px;line-height:1.5}
.idle-page p{font-size:12px;line-height:2}
.idle-paper-lines{display:none}
.idle-page small{display:block;margin-top:24px;padding-top:16px;border-top:1px solid #e4e8df}
.context-bar{padding-inline:16px;min-height:48px}
.context-body{padding:20px 16px}
.library-side[data-context-kind=beat] .context-body{padding-inline:16px}
.chord-split #context-page>.context-bar,.chord-split #library-page>.context-bar{padding-inline:16px}
.chord-split .candidates{padding-inline:12px}
.chord-candidate .candidate-select{grid-template-columns:minmax(72px,.7fr) minmax(0,1.5fr);gap:8px}
.chord-family-grid{gap:3px}
.library-page[data-rhythm-view=beat]>.library-tabs{display:none}
.library-page[data-rhythm-view=beat] .candidates{grid-template-columns:repeat(2,minmax(0,1fr))}
.rhythm-reference{grid-template-columns:60px minmax(0,1fr);gap:6px}
.reference-svg svg{max-height:112px}
.apply-target{display:flex;flex-wrap:wrap}
.apply-target span{max-width:none}
.apply-area,.object-editor-footer{padding:12px 16px;background:#fafbf7}
.editor-v2 .library-page .apply-actions button,.object-editor-footer button{min-height:44px}
.editor-v2 .editor-workspace.formal-mode{grid-template-columns:minmax(0,1fr)}
.editor-v2 .formal-mode .library-side{display:none}
/* 触屏横屏和较窄窗口沿用右侧浮窗，保留谱面可见与可点击。 */
@media (max-width:900px),(pointer:coarse) and (orientation:landscape) and (max-width:1200px){
  .editor-v2 .editor-workspace{grid-template-columns:minmax(0,1fr);padding-inline:16px}
  .editor-v2 .library-side{display:none}
  .editor-v2 .library-side.editing-popover{
    display:block;position:fixed;z-index:80;right:16px;top:116px;bottom:82px;
    width:min(440px,calc(100vw - 32px));height:auto;margin:0;overflow:hidden;
    border-radius:12px;box-shadow:0 12px 38px #173c3030;
  }
  .editor-v2 .library-side.editing-popover.chord-split{overflow-y:auto}
  .score-quick-trigger{display:block}
}
@media (min-width:901px) and (pointer:fine){
  .editor-v2 .library-side.editing-popover{position:static;width:auto;height:auto;top:auto;bottom:auto;margin-top:var(--page-top,43px);margin-bottom:var(--page-bottom,24px);border-radius:10px;box-shadow:0 4px 18px #173c3009}
}
@media (max-width:600px){
  .editor-v2 .composition-paper{padding-inline:14px}
  .editor-v2 .library-side.editing-popover{top:116px;right:8px;bottom:78px;width:calc(100vw - 16px)}
}

/* 和弦文字就近放在谱线上方，保留小节标题与拍位。 */
.editor-v2 .score-row{padding-top:var(--score-top,58px);margin-bottom:10px}
.chord-slots{top:19px}
.beat-slot{height:32px;min-height:32px;font-size:17px}
.beat-cell small{line-height:12px;font-size:10px}
.editing-hint{font-size:11px}
.library-side .results-head,.library-side .candidate-select small,.library-side .note-editor-tip{font-size:11px}
.library-side .same-beat-staff small{font-size:10px}

@media (max-width:1120px){
  .editor-v2 .workbench-v2-header{height:64px;grid-template-columns:auto minmax(0,1fr) auto;grid-template-rows:64px;padding-inline:18px}
  .editor-v2 .workbench-v2{height:calc(100dvh - 64px)}
}

.editor-v2 .score-side{grid-template-rows:auto auto minmax(0,1fr) auto}
.editor-v2 .formal-mode #track-controls{display:none}
.editor-v2 .formal-mode .score-side{grid-template-rows:auto minmax(0,1fr) auto}

.library-page[data-finder=patterns] .context-bar>div{display:grid;gap:2px;align-items:start}
.library-page[data-finder=patterns] #context-kind{font-size:11px;color:#6e7f66}

/* 手机进入明确的单页编辑状态；iPad 继续使用上面的右侧浮卡。 */
.mobile-panel-nav{display:none}
@media (max-width:600px){
  .editor-v2{--mobile-dock-height:calc(74px + env(safe-area-inset-bottom))}
  .editor-v2 .workbench-v2-header{padding-inline:10px}
  .editor-v2 .v2-brand{max-width:104px}
  .editor-v2 .v2-header-actions button>span{display:none}
  .editor-v2 .selection-tools{display:flex;flex-wrap:nowrap;gap:8px;padding:5px 8px;overflow:hidden}
  .editor-v2 .selection-tools>div:first-child{flex:none;min-width:82px}
  .editor-v2 #selection-hint{display:none}
  .editor-v2 .history-actions{flex:1;flex-wrap:nowrap;overflow-x:auto;overscroll-behavior-x:contain;scrollbar-width:none}
  .editor-v2 .history-actions::-webkit-scrollbar{display:none}
  .editor-v2 .selection-tools button{flex:none;min-height:40px;padding-inline:9px}
  .editor-v2 .score-edit-top{flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none}
  .editor-v2 .score-edit-top::-webkit-scrollbar{display:none}
  .editor-v2 .score-edit-mode>span,.editor-v2 .chord-display>span{display:none}
  .editor-v2 .score-edit-mode>button,.editor-v2 .chord-display button,.editor-v2 .track-add{min-height:40px;padding-inline:10px;white-space:nowrap}
  body[data-score-object=none] .score-operation-tools{display:none!important}
  .editor-v2 .score-operation-tools{min-height:50px;padding:5px 8px;overflow-x:auto}
  .editor-v2 .score-operation-tools .score-tab-control{flex-wrap:nowrap;width:max-content;min-width:100%}
  .editor-v2 .score-operation-tools .score-navigation>span{font-size:0}
  .editor-v2 .score-operation-tools .score-navigation>span::after{content:'左右切换：';font-size:11px}
  .editor-v2 .score-operation-cue>span{display:none}
  .editor-v2 .library-side.editing-popover{
    display:flex!important;flex-direction:column;top:0!important;right:0!important;
    bottom:calc(var(--mobile-dock-height) + max(10px,env(safe-area-inset-bottom)))!important;left:0!important;width:100vw!important;
    max-width:none;height:auto!important;margin:0;border:0;border-radius:0;
    box-shadow:none;overflow:hidden;padding-top:env(safe-area-inset-top);
  }
  .editor-v2 .library-side.editing-popover>.mobile-panel-nav{display:grid;grid-template-columns:1fr 1.25fr 1fr;flex:none;min-height:48px;padding:4px 8px;border-bottom:1px solid #dce5da;background:#f5f8f0}
  .editor-v2 .mobile-panel-nav button{min-width:0;min-height:44px;border:0;background:transparent;color:#315b47;font-size:13px;font-weight:600}
  .editor-v2 .mobile-panel-nav button:nth-child(2){border-inline:1px solid #dce5da}
  .editor-v2 .library-side.editing-popover>section:not([hidden]){flex:1;min-height:0;height:auto}
  .editor-v2 .library-side.editing-popover .context-bar>button,.editor-v2 .library-side.editing-popover [data-close],.editor-v2 .library-side.editing-popover #close-options{display:none!important}
  .editor-v2 .library-side .context-bar{position:relative;top:auto}
  .editor-v2 .library-side .chord-family-choices button,.editor-v2 .library-side .chord-shortcuts button,.editor-v2 .library-side .root-chord-choices button{min-height:44px!important}
  .editor-v2 .library-side .melody-help{display:none}
  .editor-v2 .score-quick-trigger{width:44px;height:44px;min-height:44px;border-radius:22px}
  .editor-v2 .score-context-menu button{min-height:44px}
  .editor-v2 .v2-dock{grid-template-columns:minmax(0,1fr)!important;height:var(--mobile-dock-height);min-height:var(--mobile-dock-height);padding:4px max(6px,env(safe-area-inset-right)) env(safe-area-inset-bottom) max(6px,env(safe-area-inset-left));overflow:hidden}
  .editor-v2 .v2-dock .dock-organize,.editor-v2 .v2-dock .section-nav{display:none}
  .editor-v2 .v2-dock .dock-player{display:grid!important;grid-template-columns:repeat(7,minmax(36px,1fr));gap:3px;width:100%;min-width:0}
  .editor-v2 .v2-dock .dock-player>button{width:auto!important;min-width:0!important;min-height:44px;padding-inline:3px!important}
  .editor-v2 .v2-dock .dock-utility>span,.editor-v2 .v2-dock .fullscreen-button>span{display:none}
}
@media (max-width:900px) and (max-height:500px){
  .editor-v2{--mobile-dock-height:calc(64px + env(safe-area-inset-bottom))}
  .editor-v2 .library-side.editing-popover{
    display:flex!important;flex-direction:column;top:0!important;right:0!important;
    bottom:calc(var(--mobile-dock-height) + max(10px,env(safe-area-inset-bottom)))!important;left:0!important;width:100vw!important;
    max-width:none;height:auto!important;margin:0;border:0;border-radius:0;
    box-shadow:none;overflow:hidden;padding-top:env(safe-area-inset-top);
  }
  .editor-v2 .library-side.editing-popover>.mobile-panel-nav{display:grid;grid-template-columns:1fr 1.25fr 1fr;flex:none;min-height:44px;padding:2px 8px;border-bottom:1px solid #dce5da;background:#f5f8f0}
  .editor-v2 .mobile-panel-nav button{min-width:0;min-height:40px;border:0;background:transparent;color:#315b47;font-size:12px;font-weight:600}
  .editor-v2 .mobile-panel-nav button:nth-child(2){border-inline:1px solid #dce5da}
  .editor-v2 .library-side.editing-popover>section:not([hidden]){flex:1;min-height:0;height:auto}
  .editor-v2 .library-side.editing-popover .context-bar>button,.editor-v2 .library-side.editing-popover [data-close],.editor-v2 .library-side.editing-popover #close-options{display:none!important}
}
