:root {
  font-family: "Inter", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: #233731;
  background: #f5f5ef;
  --ink: #233731;
  --green: #205848;
  --muted: #57675f;
  --line: #d8ded4;
  --card: #fefef9;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
button, input, select { font: inherit; }
button, select, input[type=file], label:has(input[type=radio]), .toggle-label { cursor: pointer; }
button { border: 0; background: transparent; color: inherit; }
button:disabled, select:disabled, button[aria-disabled=true] { cursor: default; }
button:disabled, select:disabled { opacity: .55; }
button:focus-visible, select:focus-visible, input:focus-visible, a:focus-visible, [tabindex="-1"]:focus-visible {
  outline: 3px solid #9a5200; outline-offset: 4px;
}
.player button:focus-visible, .player h2:focus-visible { outline-color: #ffda8f; }
[hidden] { display: none !important; }
h1, h2, p { margin: 0; }
.sr-only, .skip:not(:focus), .segments input, .toggle-label input {
  width: 1px; height: 1px; position: absolute; padding: 0; margin: -1px;
  overflow: hidden; white-space: nowrap; clip-path: inset(50%); border: 0;
}
.skip:focus { position: fixed; left: 1rem; top: 1rem; z-index: 5; background: white; color: var(--green); padding: .8rem 1rem; }
.frame { width: min(1160px, calc(100% - 88px)); margin-inline: auto; }
.masthead { background: #fdfdf8; border-bottom: 1px solid var(--line); }
.mast-inner { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 11px; font-size: 24px; font-weight: 750; letter-spacing: -.04em; white-space: nowrap; }
.brand-sub { font-size: 14px; color: var(--muted); font-weight: 500; border-left: 1px solid var(--line); padding-left: 16px; margin-left: 5px; letter-spacing: .04em; }
.brand-keys { width: 35px; height: 35px; border-radius: 10px; background: var(--green); display: flex; gap: 3px; align-items: flex-end; justify-content: center; padding-bottom: 8px; }
.brand-keys i { display: block; height: 17px; width: 4px; border-radius: 2px; background: #e4eec8; }
.brand-keys i:nth-child(2) { height: 21px; }
nav { display: flex; gap: 11px; }
.utility, .where, .download, .light, .primary, .play, .transport-btn {
  min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 9px;
}
.utility { padding: 5px 10px; color: #41534b; font-size: 14px; }
.utility:hover, .light:hover, .download:hover, .where:hover { background: #e9eee6; }
.utility > span { font-size: 17px; line-height: 1; }
main.frame { padding-top: clamp(32px, 4.1vw, 56px); padding-bottom: 68px; }
.page-heading { display: flex; gap: 16px; justify-content: space-between; align-items: center; margin-bottom: 29px; }
h1 { font-size: clamp(32px, 3.5vw, 46px); font-weight: 720; line-height: 1.2; letter-spacing: -.055em; }
.page-heading p { margin-top: 10px; color: var(--muted); font-size: 15px; line-height: 1.55; }
.primary { background: var(--green); color: #fff; padding: 10px 18px; font-weight: 650; font-size: 15px; }
.primary:hover { background: #164535; }
.plus { font-size: 20px; line-height: .8; font-weight: 500; }
.workspace { display: grid; grid-template-columns: minmax(255px, 31%) minmax(0, 1fr); gap: 22px; align-items: start; }
.card { border: 1px solid var(--line); border-radius: 16px; background: var(--card); }
.locator { padding: 24px; }
h2 { font-size: 20px; line-height: 1.4; letter-spacing: -.035em; }
.locator h2, .transcript h2 { display: flex; gap: 10px; align-items: center; }
.locator h2 { margin-bottom: 23px; }
.sliders-icon { position: relative; height: 16px; width: 18px; display: grid; align-content: space-between; }
.sliders-icon i { height: 2px; width: 17px; background: #527261; position: relative; }
.sliders-icon i::after { content: ""; position: absolute; left: 4px; top: -2px; width: 3px; height: 6px; background: var(--card); border: 1px solid #527261; border-radius: 1px; }
.sliders-icon i:nth-child(2)::after { left: 10px; }
label, legend { display: block; font-weight: 650; font-size: 14px; }
select, input[type=password], input[type=number] { border: 1px solid #b7c1b8; background: #fff; color: var(--ink); width: 100%; border-radius: 8px; min-height: 43px; margin-top: 7px; padding: 8px 12px; font-size: 15px; }
select { text-overflow: ellipsis; }
.paired { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.paired > div { min-width: 0; }
.divider { border-top: 1px solid var(--line); margin: 23px 0 20px; }
fieldset { border: 0; padding: 0; margin: 0 0 17px; min-width: 0; }
legend { padding: 0; margin-bottom: 8px; }
.segments { display: flex; padding: 3px; background: #edf0e9; border-radius: 9px; gap: 2px; }
.segments label { display: flex; flex: 1; min-width: 0; text-align: center; position: relative; }
.segments span { flex: 1; display: grid; place-items: center; border: 1px solid transparent; min-height: 35px; padding: 5px 1px; border-radius: 6px; color: #526258; font-size: 14px; font-weight: 500; }
.segments input:checked + span { background: #fff; border-color: #b9c8ba; color: #214e3e; font-weight: 700; box-shadow: 0 1px 3px #243d2910; }
.segments input:focus-visible + span, .toggle-label input:focus-visible + .switch { outline: 3px solid #9a5200; outline-offset: 2px; }
#clip-field { margin: 0 0 17px; }
.where { width: 100%; color: var(--green); border: 1px solid #c7d4c6; font-size: 14px; font-weight: 650; margin-top: 3px; background: #f7f9f3; }
.target-icon { font-size: 21px; line-height: 1; }
.position-description { margin: 10px 0 0; font-size: 14px; line-height: 1.7; color: var(--muted); }
.listening { min-width: 0; }
.player { position: relative; background: #234c40; color: #fff; border-color: #234c40; overflow: hidden; }
.player-top { position: relative; display: flex; padding: 28px 30px 17px; min-height: 149px; overflow: hidden; }
.player-copy { position: relative; z-index: 1; max-width: 74%; }
.player-label { font-size: 13px; color: #dce8d9; letter-spacing: .07em; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.sound-bars { display: flex; gap: 3px; align-items: center; }
.sound-bars i { background: #d1e7a7; border-radius: 2px; width: 3px; height: 7px; }
.sound-bars i:nth-child(2) { height: 14px; }
.sound-bars i:nth-child(3) { height: 10px; }
.player h2 { font-size: clamp(28px, 3.3vw, 43px); letter-spacing: -.04em; line-height: 1.22; margin: 12px 0 7px; overflow-wrap: anywhere; }
#clip-context { font-size: 14px; line-height: 1.65; color: #e2eadf; }
.piano-art { position: absolute; width: clamp(120px, 19vw, 220px); height: 113px; right: -24px; top: 13px; opacity: .28; transform: rotate(13deg); pointer-events: none; }
.keybed { height: 100%; border: 1.5px solid #a9bc9e; border-radius: 4px; background: repeating-linear-gradient(90deg, transparent 0 14px, #a9bc9e 14px 15px); }
.keybed::before { content: ""; position: absolute; inset: 1px 0 auto; height: 62%; background: repeating-linear-gradient(90deg, transparent 0 10px, #a9bc9e 10px 18px, transparent 18px 25px, #a9bc9e 25px 33px, transparent 33px 55px, #a9bc9e 55px 63px, transparent 63px 70px, #a9bc9e 70px 78px, transparent 78px 85px, #a9bc9e 85px 93px, transparent 93px 105px); }
.player-bottom { padding: 4px 30px 25px; }
.timeline { display: flex; gap: 12px; align-items: center; }
.rail { flex: 1; height: 3px; border-radius: 2px; background: #648276; overflow: hidden; }
#played { height: 100%; display: block; width: 0; border-radius: 2px; background: #d7e9a5; }
#duration { font: 12px/1.5 ui-monospace, monospace; color: #e1e7df; white-space: nowrap; }
.transport { display: flex; gap: 8px; align-items: center; margin-top: 18px; }
.play { background: #def0b6; color: #1d4031; font-weight: 700; padding: 9px 17px; white-space: nowrap; }
.play:hover { background: #eafaaf; }
.play-icon { border-block: 6px solid transparent; border-left: 9px solid currentColor; }
.play-icon.pause { width: 9px; height: 12px; border-block: 0; border-inline: 3px solid currentColor; }
.play-icon.cancel { width: 10px; height: 10px; background: currentColor; border: 0; }
.transport-btn { font-size: 14px; color: #f7faf3; padding: 5px 8px; white-space: nowrap; }
.transport-btn:hover { background: #385e51; }
.transport-btn:disabled, .transport-btn[aria-disabled=true] { opacity: .62; }
.transport-btn > span[aria-hidden] { font-size: 23px; line-height: 1; }
.previous-next { margin-left: auto; display: flex; gap: 5px; }
.player-options { display: flex; align-items: center; gap: 11px; flex-wrap: wrap; min-height: 56px; padding: 6px 4px; }
.toggle-label { position: relative; display: inline-flex; gap: 8px; align-items: center; min-height: 38px; font-size: 14px; }
.switch { width: 29px; height: 17px; background: #65756b; display: block; border-radius: 20px; padding: 3px; }
.switch::after { content: ""; display: block; width: 11px; height: 11px; background: white; border-radius: 50%; }
.toggle-label input:checked + .switch { background: var(--green); }
.toggle-label input:checked + .switch::after { margin-left: 12px; }
.player-state { color: var(--muted); font-size: 13px; }
.transcript { padding: 20px 24px 17px; }
.transcript-head { display: flex; align-items: center; gap: 8px; justify-content: space-between; padding-bottom: 13px; border-bottom: 1px solid var(--line); }
.sheet-icon { width: 16px; height: 19px; border: 1.5px solid #527261; border-radius: 3px; display: grid; gap: 2px; align-content: center; padding: 2px 3px; }
.sheet-icon i { height: 1.5px; background: #527261; }
.sheet-icon i:last-child { width: 60%; }
.download { min-height: 37px; border: 1px solid var(--line); padding: 5px 10px; color: var(--green); font-size: 13px; font-weight: 650; white-space: nowrap; }
.download > [aria-hidden] { font-size: 19px; line-height: .8; }
#transcript { padding: 17px 0 13px; font-size: 17px; line-height: 1.95; white-space: pre-line; overflow-wrap: anywhere; }
.transcript-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 9px; font-size: 13px; line-height: 1.6; color: var(--muted); }
a, .link-button { color: #17543e; text-underline-offset: 3px; }
.warning { margin-top: 16px; padding: 20px 24px; background: #fff8e8; border-color: #e4d3aa; }
.warning h2 { font-size: 17px; }
.warning p, .key-notice p { line-height: 1.7; margin: 8px 0; }
.light, .link-button { padding: 6px 13px; border: 1px solid #becbbd; background: #fff; font-size: 14px; }
.link-button { border: 0; text-decoration: underline; background: transparent; padding: 4px 0; }
dialog { width: min(460px, calc(100% - 32px)); max-height: calc(100% - 40px); padding: 25px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; color: var(--ink); box-shadow: 0 15px 55px #182c2033; }
dialog::backdrop { background: #162c25a6; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 20px; }
.close { width: 39px; height: 39px; border-radius: 9px; font-size: 27px; background: #edf1ea; }
.hint, .privacy, .key-notice { font-size: 14px; line-height: 1.7; color: var(--muted); }
.hint { margin: 8px 0 16px; }
#import-progress { width: 100%; height: 7px; accent-color: var(--green); }
.privacy, .key-notice { padding: 12px 14px; background: #eff3e9; border-radius: 9px; margin: 10px 0; color: #344c3e; }
.key-notice p { margin-top: 0; }
input[type=file] { width: 100%; margin-top: 8px; font-size: 14px; color: var(--muted); }
input::file-selector-button { border: 1px solid #a6b7aa; border-radius: 7px; padding: 10px 13px; background: white; color: var(--green); font: inherit; margin-right: 8px; }
.error { color: #8b3025; font-size: 14px; line-height: 1.65; }
.error:not(:empty) { padding: 11px 13px; border-radius: 7px; background: #ffede6; margin: 10px 0; }
.banner:not(:empty) { margin-bottom: 12px; }
#retry-start { margin: 0 0 15px; }
.key-help { margin: 0; }
.key-help dt { font-size: 14px; font-weight: 650; }
.key-help dd { font-size: 14px; line-height: 1.7; margin: 5px 0 16px; color: var(--muted); }
kbd { font: 13px/1.4 ui-monospace, monospace; background: #eef1ed; border: 1px solid var(--line); padding: 2px 5px; border-radius: 4px; }
@media (max-width: 900px) {
  .frame { width: calc(100% - 48px); }
  .workspace { grid-template-columns: minmax(230px, 32%) minmax(0, 1fr); gap: 15px; }
  .locator, .transcript { padding: 18px; }
  .player-top { padding: 23px 20px 17px; }
  .player-bottom { padding: 4px 20px 17px; }
  .piano-art { width: 110px; right: -28px; height: 82px; }
  .transport { flex-wrap: wrap; gap: 5px; }
  .previous-next { gap: 0; }
  .transport-btn { padding-inline: 5px; }
}
@media (max-width: 695px) {
  .frame { width: calc(100% - 32px); }
  .mast-inner { min-height: 59px; }
  .brand-sub { display: none; }
  nav { gap: 1px; }
  .utility { padding-inline: 7px; }
  main.frame { padding-block: 25px 36px; }
  .page-heading { margin-bottom: 17px; }
  .page-heading p { font-size: 13px; }
  .workspace { grid-template-columns: 1fr; }
  .locator h2 { margin-bottom: 15px; }
  .locator .paired { margin-top: 13px; }
  .divider { margin: 16px 0; }
  fieldset { margin-bottom: 12px; }
  .player-top { min-height: 127px; }
  .player-copy { max-width: 78%; }
  .transcript-head { flex-wrap: wrap; }
}
@media (max-width: 375px) {
  .frame { width: calc(100% - 20px); }
  .utility { font-size: 13px; gap: 4px; }
  .utility > span { display: none; }
  .primary { padding-inline: 11px; }
  .player-top { padding: 20px 14px 11px; }
  .player-bottom { padding: 7px 14px 14px; }
  .transport-btn { gap: 3px; }
  .play { padding-inline: 9px; }
}
@media (forced-colors: active) {
  .segments input:checked + span, .toggle-label input:checked + .switch { outline: 2px solid Highlight; }
  .player, .play, .switch, .primary, .rail { border: 1px solid ButtonText; }
}

.page-actions { display: flex; gap: 9px; flex-wrap: wrap; }
.key-entry { color: var(--green); font-weight: 650; }
.key-entry > [aria-hidden] { font-size: 18px; }
#keyboard-zone { background: #eaf0df; border: 1px solid #a8bc9c; border-radius: 12px; padding: 15px 20px; margin: 0 0 19px; }
#keyboard-zone:focus { outline: 3px solid #875511; outline-offset: 3px; }
#keyboard-zone h2 { font-size: 17px; margin-bottom: 5px; }
#keyboard-zone p { font-size: 14px; line-height: 1.7; }
@media (max-width: 695px) {
  .page-heading { align-items: flex-start; flex-direction: column; gap: 12px; }
}
.source-note { margin-top: 8px; color: var(--muted); font-size: 13px; line-height: 1.65; overflow-wrap: anywhere; }
.bookmark-actions { display: flex; gap: 8px; margin-top: 8px; }
.bookmark-actions button { flex: 1; min-height: 36px; }
.rate-control { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.rate-control label { white-space: nowrap; }
.rate-control select { font-size: 14px; min-height: 36px; width: auto; margin: 0; padding: 4px 8px; }
#open-review { margin-top: 12px; }
#review-dialog { width: min(620px, calc(100% - 32px)); }
#review-dialog h3 { font-size: 16px; margin: 0 0 6px; }
#review-differences { padding-inline-start: 1.5em; line-height: 1.75; margin: 8px 0 18px; overflow-wrap: anywhere; }
.reading { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 14px; }
.reading p { line-height: 1.85; overflow-wrap: anywhere; margin: 4px 0 8px; }
.review-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
#settings-dialog form + form { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
#openai-form button { margin-top: 10px; }
.piano-check { padding: 20px 24px; margin-bottom: 16px; container-type: inline-size; }
.piano-check fieldset { margin: 14px 0 0; }
.piano-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@container (min-width: 37rem) { .piano-options { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@container (max-width: 17rem) { .piano-options { grid-template-columns: 1fr; } }
.piano-actions, .reading-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.piano-actions { margin-top: 14px; }
.piano-check .source-note:empty, #review-piano-status:empty { margin: 0; }
.piano-warnings { margin-top: 10px; color: var(--muted); font-size: 14px; line-height: 1.7; }
.piano-warnings summary { cursor: pointer; color: var(--green); }
.piano-warnings summary:focus-visible { outline: 3px solid #9a5200; outline-offset: 3px; }
.piano-warnings ul { margin-block: 8px; padding-inline-start: 1.5em; }
#midi-link { display: inline-block; margin-top: 6px; font-size: 14px; }
@media (max-width: 900px) { .piano-check { padding: 18px; } }
