:root{font-family:Inter,ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;color:#342d29;background:#f8f5ee;--ink:#342d29;--accent:#a63f2d;--accent-dark:#873020;--line:#e0d8cc;--soft:#f8e8df;--paper:#fffdf8;--muted:#6f6259}*{box-sizing:border-box}body{margin:0;height:100vh;height:100dvh;min-height:640px;display:flex;flex-direction:column}button,input,select,textarea{font:inherit;color:inherit}button,select,summary,.file-button{cursor:pointer}button,select,input,textarea,.file-button{border:1px solid var(--line);border-radius:7px;background:var(--paper);padding:8px 12px}button{font-weight:600;min-height:36px;white-space:nowrap}button:hover,.file-button:hover{background:#f6eee5;border-color:#bd9d8f}button.primary{color:white;background:var(--accent);border-color:var(--accent)}button.primary:hover{background:var(--accent-dark)}button:disabled{opacity:.45;cursor:default}button[aria-pressed=true]{background:var(--soft);border-color:var(--accent)}button:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible,summary:focus-visible,a:focus-visible{outline:3px solid #2256a1;outline-offset:3px}a{color:inherit}h1,h2,h3,p{margin:0}h1{font-size:22px;letter-spacing:-.5px}h2{font-size:16px}h3{font-size:13px}p{line-height:1.4}.app-header{display:flex;align-items:center;justify-content:space-between;gap:20px;padding:10px 24px;border-bottom:1px solid var(--line);flex-shrink:0}.brand{display:flex;align-items:center;gap:10px;text-decoration:none}.brand small{display:block;color:var(--muted);font-size:11px;margin-top:2px}.seal{font-family:serif;font-size:23px;width:36px;height:36px;border:1px solid var(--accent);color:var(--accent);display:grid;place-items:center;border-radius:5px}.header-actions{display:flex;gap:7px;align-items:center}.header-actions button{font-size:12px}#savedCount{display:inline-block;font-size:10px;min-width:18px;background:var(--soft);border-radius:10px;padding:1px 4px}#language{font-weight:400;border-color:transparent;background:none}main{display:flex;flex-direction:column;flex:1;min-height:0;width:100%;padding:8px 24px 0;gap:10px}.toolbar{display:flex;align-items:center;gap:12px;flex-shrink:0}.toolbar button{font-size:12px}.starting-point{display:flex;align-items:center;gap:8px;min-width:0}.starting-point label{font-size:11px;color:var(--muted);white-space:nowrap}.starting-point select{max-width:245px;font-size:12px;min-width:0;padding:8px}.transport{display:flex;gap:5px;margin-left:auto}#saveVersion{margin-left:6px}.phrase-panel{border:1px solid var(--line);border-top:3px solid var(--accent);background:var(--paper);border-radius:12px;display:flex;flex-direction:column;flex:1;min-height:0;box-shadow:0 2px 6px #5d382405}.panel-heading,.half-heading,.suggestions-heading{display:flex;align-items:center;justify-content:space-between;gap:12px}.panel-heading{padding:12px 16px 6px}.panel-heading p{font-size:11px;color:var(--muted);margin-top:4px}.badge{font-size:10px;border:1px solid var(--line);border-radius:12px;padding:4px 8px;white-space:nowrap;color:var(--muted)}.phrase-grids{display:grid;grid-template-columns:1fr 1fr;gap:18px;padding:0 16px;flex:1;min-height:0}.half{min-width:0;display:flex;flex-direction:column}.half-heading{min-height:30px;flex-shrink:0}.half-heading span{font-size:10px;color:var(--muted)}.note-grid{display:grid;grid-template-columns:38px repeat(8,minmax(0,1fr));grid-template-rows:20px repeat(6,minmax(0,1fr));gap:3px;flex:1;min-height:0}.beat,.row-label{display:flex;align-items:center;justify-content:center;font-size:10px;color:var(--muted)}.row-label{font-weight:600;justify-content:flex-start;gap:3px}.cell{min-width:0;min-height:0;border-radius:5px;border-color:#e9e0d6;background:#f6f2ea;padding:0;font-size:14px;display:flex;align-items:center;justify-content:center;gap:4px;font-weight:600}.cell b,.cell i{font-style:normal;visibility:hidden}.cell i{font-size:10px;font-weight:400}.cell.on{background:var(--accent);color:white;border-color:var(--accent)}#responseGrid .cell.on{background:#7c5345;border-color:#7c5345}.cell.on b,.cell.on i{visibility:visible}.cell:hover{background:#edc7b4}.cell.on:hover{background:var(--accent-dark)}.cell.playing{outline:3px solid #e3aa38;outline-offset:-3px;box-shadow:0 0 0 1px #362400}.row-label b{font-size:12px}.row-label i{font-style:normal;font-size:9px}.comparison-strip{display:grid;grid-template-columns:1fr 1fr;gap:18px;padding:9px 16px 6px}.comparison-strip>div{display:flex;align-items:center;justify-content:space-between;gap:12px;min-width:0}.comparison-strip span{font-size:10px;color:var(--muted);white-space:nowrap}.comparison-strip strong{font:500 15px ui-monospace,SFMono-Regular,monospace;letter-spacing:2px;white-space:nowrap}.phrase-foot{padding:6px 16px;display:flex;align-items:center;justify-content:space-between;gap:8px;border-top:1px solid var(--line);font-size:11px;color:var(--muted)}.phrase-foot>div{display:flex;gap:5px}.phrase-foot button{font-size:11px;min-height:30px;padding:4px 9px}.suggestions-panel{flex-shrink:0}.suggestions-heading{padding:0 0 8px}.suggestions-heading p{font-size:11px;color:var(--muted);margin-top:3px}.suggestions-heading button{font-size:12px}.suggestion-cards{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}.suggestion{border:1px solid var(--line);border-radius:10px;background:var(--paper);padding:10px 12px;display:flex;flex-direction:column;gap:6px}.suggestion.chosen{border-color:var(--accent);box-shadow:inset 0 0 0 1px var(--accent);background:#fff7f0}.suggestion header{display:flex;align-items:center;justify-content:space-between;gap:5px;min-height:18px}.suggestion h3{font-size:12px}.selection-label{font-size:10px;color:var(--accent)}.mini-contour{height:46px;width:100%;display:block;background:linear-gradient(to bottom,transparent 32%,#e9e0d6 33%,transparent 34%,transparent 65%,#e9e0d6 66%,transparent 67%);border-radius:3px}.suggestion .notation{font:500 13px ui-monospace,SFMono-Regular,monospace;letter-spacing:1.5px;text-align:center}.suggestion-actions{display:flex;gap:7px;margin-top:2px}.suggestion-actions button{flex:1;min-height:32px;padding:5px 7px;font-size:11px}.suggestion-actions .choose{color:var(--accent);border-color:#ce9f8e}.suggestion.chosen .choose{color:white;background:var(--accent);border-color:var(--accent)}footer{display:flex;justify-content:space-between;gap:14px;font-size:10px;color:var(--muted);padding:0 0 8px;flex-shrink:0;min-height:22px}footer #status{color:var(--accent-dark)}.phrase-tabs{display:none}.skip-link{position:fixed;top:8px;left:8px;transform:translateY(-150%);z-index:10;background:white;padding:10px}.skip-link:focus{transform:translateY(0)}dialog{width:min(620px,calc(100vw - 24px));max-height:calc(100dvh - 24px);overflow:auto;border:1px solid var(--line);border-radius:14px;padding:22px;color:var(--ink);background:var(--paper);box-shadow:0 20px 90px #28180e40}dialog::backdrop{background:#31251e65}.dialog-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:16px}.dialog-heading button{font-size:12px}dialog p{font-size:13px;color:var(--muted);margin-bottom:14px}dialog label:not(.check):not(.file-button){display:block;font-size:12px;font-weight:600;margin:14px 0 7px}dialog input:not([type=checkbox]):not([type=file]),dialog textarea{width:100%;resize:vertical}dialog .dialog-actions{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:8px;margin-top:16px}dialog button{min-height:40px;font-size:12px}.check{display:flex;gap:10px;align-items:center;min-height:44px;font-size:13px}.check input{width:18px;height:18px;accent-color:var(--accent)}details{border-top:1px solid var(--line);padding:13px 0}summary{font-size:13px;font-weight:600;min-height:26px}details p{margin:10px 0 0}#saveError:empty,#notebookStatus:empty{display:none}#saveError,#notebookStatus{margin-top:12px;color:var(--accent-dark)}.notebook-actions{display:flex;gap:8px;flex-wrap:wrap}.file-button{display:inline-flex;align-items:center;position:relative;font-size:12px;font-weight:600}.file-button input{position:absolute;inset:0;width:100%;opacity:0;cursor:pointer}.file-button:focus-within{outline:3px solid #2256a1;outline-offset:3px}#versionList{display:flex;flex-direction:column;gap:10px;margin-top:18px}.version{padding:13px;border:1px solid var(--line);border-radius:8px}.version h3{font-size:14px;overflow-wrap:anywhere}.version p{margin:5px 0;font-size:11px}.version .notes{font-family:ui-monospace,monospace;letter-spacing:1px;overflow-wrap:anywhere}.version .actions{display:flex;gap:7px;margin-top:10px}[hidden]{display:none!important}body.no-jianpu .cell b{display:none}body.no-solfege .cell i{display:none}
@media(min-width:1500px){main{padding-left:40px;padding-right:40px}.app-header{padding-left:40px;padding-right:40px}.suggestion{padding:12px 16px}.mini-contour{height:58px}.suggestion-actions button{min-height:36px}}
@media(max-height:760px) and (min-width:700px){body{min-height:600px}main{gap:7px}.app-header{padding-top:7px;padding-bottom:7px}.panel-heading{padding-top:8px}.suggestion{padding:7px 10px;gap:5px}.mini-contour{height:36px}.comparison-strip{padding-top:5px;padding-bottom:5px}.phrase-foot{padding-top:4px;padding-bottom:4px}.phrase-foot button{min-height:28px}.note-grid{grid-template-rows:17px repeat(6,minmax(0,1fr))}.suggestions-heading{padding-bottom:5px}}
@media(max-width:1100px){.app-header{padding-left:16px;padding-right:16px}main{padding-left:16px;padding-right:16px}.starting-point label{display:none}.starting-point select{max-width:220px}.toolbar{gap:7px}.comparison-strip strong{font-size:14px;letter-spacing:1.5px}.phrase-grids{gap:14px}.cell i{display:none}.panel-heading p{max-width:570px}}
@media(max-width:699px){body{min-height:800px}.app-header{padding:8px 12px;gap:8px;flex-wrap:wrap}.brand{gap:7px}.brand h1{font-size:19px}.brand small{font-size:10px}.seal{display:none}.header-actions{gap:4px;margin-left:auto}.header-actions button{min-height:32px;padding:6px 7px;font-size:11px}#newPhrase{display:none}#language{padding-left:2px;padding-right:2px}.header-actions #savedCount{min-width:14px}.app-header .brand{width:100%}.header-actions{position:absolute;right:10px;top:10px}.header-actions #settings{display:none}main{padding:7px 10px 0;gap:7px}.toolbar{display:grid;grid-template-columns:1fr auto;gap:6px}.starting-point select{width:100%;max-width:none;height:36px;font-size:12px}.transport{margin:0;gap:4px}.toolbar button{padding:6px 8px;font-size:11px;min-height:36px}#saveVersion{grid-column:2;grid-row:1;margin:0}.transport{grid-column:1 / -1;grid-row:2}#mute{margin-left:auto}.phrase-panel{flex:1;min-height:350px}.panel-heading{padding:9px 10px 4px;gap:5px}.panel-heading h2{font-size:14px}.panel-heading p{font-size:10px;line-height:1.3;max-width:260px}.badge{font-size:9px;padding:3px 5px}.phrase-tabs{display:flex;padding:5px 10px;gap:6px}.phrase-tabs button{flex:1;min-height:30px;padding:4px 8px;font-size:12px}.phrase-tabs button[aria-selected=true]{background:var(--soft);border-color:var(--accent);color:var(--accent)}.phrase-grids{display:block;flex:1;min-height:0;padding:0 10px}.half{height:100%}.half-heading{display:none}.note-grid{height:100%;grid-template-columns:32px repeat(8,minmax(0,1fr));grid-template-rows:16px repeat(6,minmax(0,1fr));gap:3px}body:not(.editing-response) #responsePanel,body.editing-response #callPanel{display:none}.row-label{font-size:9px}.row-label i{font-size:8px}.cell i{display:none}.comparison-strip{gap:9px;padding:7px 10px}.comparison-strip>div{flex-direction:column;gap:3px;align-items:flex-start}.comparison-strip strong{font-size:12px;letter-spacing:1px}.comparison-strip span{font-size:9px}.phrase-foot{padding:5px 10px;font-size:9px;gap:6px}.phrase-foot button{font-size:10px;min-height:30px;padding:4px 6px}.phrase-foot>span{max-width:52%;line-height:1.3}.suggestions-heading h2{font-size:14px}.suggestions-heading p{font-size:9px;max-width:235px}.suggestions-heading button{font-size:10px;min-height:32px;padding:5px 7px}.suggestion-cards{display:flex;overflow-x:auto;scroll-snap-type:x mandatory;gap:8px;padding:0 1px 5px;overscroll-behavior-x:contain}.suggestion{flex:0 0 79%;scroll-snap-align:start;padding:8px 10px;gap:5px}.suggestion h3{font-size:12px}.mini-contour{height:32px}.suggestion .notation{font-size:12px}.suggestion-actions button{min-height:34px;font-size:11px}.suggestions-panel{min-width:0}footer{font-size:9px;gap:5px;padding-bottom:6px;flex-direction:column}footer>span{display:none}dialog{padding:16px}.dialog-actions button{flex:1}#notebookDialog::after{content:''}#notebookDialog .mobile-actions{display:flex;gap:7px;margin-top:16px}}
@media(max-width:360px){.header-actions button{font-size:10px;padding:5px}.brand h1{font-size:16px}.brand small{font-size:9px}.comparison-strip strong{font-size:11px;letter-spacing:.3px}}
@media(pointer:coarse) and (min-width:700px){button{min-height:42px}.note-grid{grid-template-rows:20px repeat(6,minmax(0,1fr))}.suggestion-actions button{min-height:40px}}
@media(max-height:590px){body{height:auto;min-height:780px}.phrase-panel{min-height:350px}main{min-height:700px}dialog{max-height:calc(100dvh - 16px)}}
@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important}}

/* Transport revision: the complete playback group sits immediately below the phrase. */
.toolbar{justify-content:space-between}.toolbar #saveVersion{margin-left:auto}
.phrase-foot{display:grid;grid-template-columns:auto minmax(0,1fr) auto;gap:12px;padding:7px 16px;background:#fbf1e9;border-radius:0 0 11px 11px}
.phrase-foot .transport{display:flex;gap:7px;margin:0;align-items:center}
.phrase-foot .transport button{min-height:44px;padding:8px 14px;font-size:13px;border-color:#bf9885;color:var(--ink)}
.phrase-foot .transport #playAll{color:white;border-color:var(--accent);background:var(--accent);box-shadow:0 2px 3px #5e23171a}
.phrase-foot .transport #stop{background:#fff9f2;border-width:2px}.phrase-foot #sourceLabel{font-size:11px;text-align:center}
@media(min-width:700px) and (max-height:720px){
 body{min-height:560px}.app-header{padding-top:6px;padding-bottom:6px}.brand small{display:none}.app-header h1{font-size:20px}.seal{height:32px;width:32px;font-size:21px}
 main{padding-top:6px;gap:6px}.toolbar button,.starting-point select{min-height:34px;padding-top:6px;padding-bottom:6px}
 .panel-heading{padding:7px 12px 3px}.panel-heading h2{font-size:14px}.panel-heading p{display:none}
 .phrase-grids{padding:0 12px;gap:12px}.half-heading{min-height:25px}.note-grid{grid-template-rows:16px repeat(6,minmax(0,1fr))}
 .comparison-strip{padding:5px 12px}.phrase-foot{padding:5px 12px;gap:8px}.phrase-foot #sourceLabel{font-size:10px}
 .suggestions-heading h2{font-size:14px}.suggestions-heading p{font-size:10px}.suggestion{padding:7px 10px;gap:4px}.mini-contour{height:28px}.suggestion-actions button{min-height:32px}
 footer{padding-bottom:5px;min-height:18px}
}
@media(min-width:700px) and (max-height:600px){
 body{min-height:500px}.app-header{padding-top:4px;padding-bottom:4px}.app-header button{min-height:32px;padding:5px 9px}.app-header h1{font-size:18px}.seal{height:28px;width:28px;font-size:19px}
 main{gap:4px;padding-top:4px}.toolbar button,.starting-point select{min-height:30px;padding-top:4px;padding-bottom:4px}.panel-heading{padding-top:4px;padding-bottom:2px}.badge{padding-top:2px;padding-bottom:2px}
 .note-grid{grid-template-rows:14px repeat(6,minmax(0,1fr));gap:2px}.half-heading{min-height:22px}.half-heading h3{font-size:12px}.comparison-strip{padding-top:3px;padding-bottom:3px}.comparison-strip strong{font-size:12px}
 .phrase-foot{padding-top:4px;padding-bottom:4px}.phrase-foot .transport button{min-height:40px;padding:6px 12px;font-size:12px}.suggestions-heading{padding-bottom:4px}.suggestions-heading p{display:none}.suggestions-heading button{min-height:30px}
 .suggestion{padding:5px 8px;gap:3px}.mini-contour{height:23px}.suggestion .notation{font-size:12px}.suggestion-actions button{min-height:30px;padding-top:4px;padding-bottom:4px}
}
@media(max-width:699px){
 .toolbar{display:flex;gap:7px}.starting-point{flex:1}.toolbar #saveVersion{flex-shrink:0}.phrase-foot{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:6px;padding:6px 10px}
 .phrase-foot .transport{grid-column:1 / -1;gap:6px;display:flex}.phrase-foot .transport button{min-height:40px;padding:7px 10px;font-size:12px}.phrase-foot .transport #mute{margin-left:auto}
 .phrase-foot #sourceLabel{max-width:none;text-align:left;font-size:9px}.phrase-foot>div:last-child{gap:5px}.phrase-panel{min-height:390px}
}
@media(min-width:700px) and (max-height:600px){body{height:100vh;height:100dvh}main,.phrase-panel{min-height:0}}
.previewing .note-grid{outline:2px dashed #bd8758;outline-offset:4px;border-radius:4px}.previewing .cell:disabled{opacity:1;cursor:default}.mini-contour .preview-note.playing{fill:#dc9a27;stroke:#703f11;stroke-width:2px}

/* Tablet QA: preserve a separate readout row even when browser chrome reduces height. */
.half{min-height:0}.panel-heading,.comparison-strip,.phrase-foot{flex-shrink:0}
.comparison-strip{padding-top:8px;padding-bottom:6px}.comparison-strip strong{line-height:1.5}
footer{padding-bottom:max(8px,env(safe-area-inset-bottom))}
/* Save fields scroll independently; actions stay above the software keyboard. */
#saveDialog{position:fixed;inset:auto;margin:0;padding:0;overflow:hidden;left:calc(var(--save-left,0px) + var(--save-width,100vw)/2);top:calc(var(--save-top,0px) + max(12px,(var(--save-height,100dvh) - 480px)/2));transform:translateX(-50%);width:min(620px,calc(var(--save-width,100vw) - 24px));height:min(480px,calc(var(--save-height,100dvh) - 24px));max-height:none}
#saveForm{display:flex;flex-direction:column;height:100%;min-height:0}
#saveDialog .dialog-heading{flex:0 0 auto;margin:0;padding:14px 18px 10px;gap:12px}
#saveTitle{font-size:16px;line-height:1.3}
#saveDialog .save-fields{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;padding:0 18px 14px;scroll-padding:8px}
#saveDialog input,#saveDialog textarea{font-size:16px;line-height:1.4}
#saveDialog textarea{height:80px;min-height:56px;max-height:180px;resize:vertical}
#saveDialog #downloadDraft{margin-top:12px}
#saveDialog .dialog-actions{flex:0 0 auto;display:flex;flex-wrap:nowrap;justify-content:flex-end;gap:8px;margin:0;padding:10px 18px;border-top:1px solid var(--line);background:var(--paper)}
#saveDialog .dialog-actions button{min-height:44px;white-space:normal}
@media(max-width:699px){#saveDialog .dialog-heading{padding:10px 14px 8px}#saveDialog .save-fields{padding-left:14px;padding-right:14px}#saveDialog .dialog-actions{padding:8px 14px}}
