#piano-app {
    max-width: 1800px;
    margin: 0 auto;
    padding: 80px 1.4rem 1.4rem;
    color: #243748;
}
#piano-app h1 {
    color: #0f766e;
    font-size: clamp(1.6rem, 4vw, 2.3rem);
    font-weight: 700;
    margin: 0.5rem 0 1rem;
}
#piano-app h2 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 0.7rem;
}
#piano-app p {
    line-height: 1.85;
}
.piano-eyebrow {
    color: #386b65;
    font-size: 0.8rem;
    letter-spacing: 0.16em;
    font-weight: bold;
}
.piano-intro {
    margin-bottom: 1.5rem;
}
.piano-panel {
    background: #effaf8;
    border: 1px solid #b7dcd6;
    border-radius: 18px;
    padding: 1.2rem;
    margin: 1.2rem 0;
    box-shadow: 0 4px 14px #24374808;
}
.piano-controls {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}
.piano-controls label,
.piano-tempo label {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    font-size: 0.9rem;
    font-weight: bold;
}
#piano-app select,
#piano-app input[type='number'] {
    width: 100%;
    min-height: 46px;
    border: 1px solid #6a9992;
    border-radius: 8px;
    padding: 0.5rem;
    color: #243748;
    background: white;
}
.piano-transport {
    position: sticky;
    top: 60px;
    z-index: 20;
    background: #effaf8f5;
}
.piano-tempo {
    display: grid;
    grid-template-columns: 120px 1fr 130px;
    align-items: end;
    gap: 1rem;
}
#piano-app input[type='range'] {
    width: 100%;
    min-height: 38px;
    accent-color: #0f766e;
}
.piano-buttons,
.piano-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem 1.2rem;
    margin-top: 1rem;
    align-items: center;
}
#piano-app button {
    padding: 0.7rem 1.7rem;
    border: 1px solid #0f766e;
    border-radius: 9px;
    font-weight: bold;
    min-height: 46px;
    background: white;
    color: #115e59;
}
#piano-app #piano-play {
    background: #0f766e;
    color: white;
}
#piano-app button:disabled {
    opacity: 0.5;
    cursor: default;
}
#piano-app :focus-visible {
    outline: 3px solid #ad6526;
    outline-offset: 3px;
}
.piano-checks label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 32px;
    font-size: 0.9rem;
}
.piano-checks input {
    accent-color: #0f766e;
    width: 18px;
    height: 18px;
}
#piano-status {
    flex: 1;
    min-width: 140px;
    font-size: 0.9rem;
}
.piano-score-card {
    background: white;
    border-radius: 14px;
    padding: 1rem;
    border: 1px solid #b7dcd6;
}
#piano-score {
    overflow-x: auto;
    color: #172632;
}
.piano-system {
    margin-bottom: 0.5rem;
    border-bottom: 1px solid #d7ebe7;
}
.piano-system svg {
    display: block;
}
.piano-active,
.piano-active * {
    fill: #bd491d !important;
    stroke: #bd491d !important;
}
.piano-note {
    font-size: 0.85rem;
    color: #476963;
    margin: 0.8rem 0;
}
#piano-app details {
    margin: 1.2rem 0;
}
#piano-app summary {
    cursor: pointer;
    font-weight: bold;
    padding: 0.6rem 0;
}
#piano-app table {
    border-collapse: collapse;
    width: 100%;
    text-align: center;
}
#piano-app td,
#piano-app th {
    padding: 0.45rem;
    border: 1px solid #b7dcd6;
}
#piano-app th {
    background: #effaf8;
}
#piano-app a {
    color: #0f766e;
    text-decoration: underline;
}
@media (max-width: 650px) {
    #piano-app {
        margin: 0 auto;
        padding: 70px 0.7rem 0.7rem;
    }
    .piano-controls {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .piano-controls .piano-type {
        grid-column: 1 / -1;
    }
    .piano-panel {
        padding: 0.9rem;
    }
    .piano-tempo {
        grid-template-columns: 90px 1fr;
        gap: 0.6rem;
    }
    .piano-volume {
        grid-column: 1 / -1;
    }
    .piano-transport {
        position: static;
    }
    .piano-score-card {
        padding: 0.5rem;
    }
}
/* 楽譜を主役にし、通常操作を小さなバーにまとめる。 */
#piano-app {
    padding-top: 68px;
}
#piano-app h1 {
    font-size: clamp(1.3rem, 3vw, 1.7rem);
    margin: 0 0 0.65rem;
}
.piano-selection {
    display: flex;
    gap: 0.8rem;
    margin-bottom: 0.8rem;
}
.piano-selection label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    white-space: nowrap;
}
.piano-selection select {
    width: auto !important;
    min-height: 38px !important;
}
.piano-score-card {
    padding: 0.65rem;
}
#piano-score {
    padding-block: 1rem;
}
.piano-browse {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem 1rem;
    margin-bottom: 0.8rem;
}
.piano-browse label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    white-space: nowrap;
}
.piano-browse label[hidden],
#piano-all-note[hidden] {
    display: none;
}
.piano-browse select {
    width: auto !important;
    min-height: 38px !important;
}
.piano-key-section + .piano-key-section {
    border-top: 1px solid #b7dcd6;
    padding-top: 1rem;
}
.piano-key-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}
.piano-key-heading h3 {
    color: #0f766e;
    font-weight: bold;
    border: 0;
    margin: 0;
}
.piano-key-heading button {
    font-size: 0.8rem;
    flex-shrink: 0;
    white-space: nowrap;
}
.piano-all-mode .piano-transport {
    position: sticky;
    top: 55px;
    z-index: 20;
    background: #effaf8f5;
}
#piano-summary {
    margin: 0 !important;
    font-size: 1rem !important;
    text-decoration: none;
}
.piano-system {
    margin: 0;
    border: 0;
}
.piano-transport {
    position: static;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.7rem;
    padding: 0.7rem 0;
    background: transparent;
}
.piano-transport label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.85rem;
}
#piano-tempo {
    width: 76px !important;
    min-height: 40px !important;
}
#piano-app button {
    min-height: 40px;
    padding: 0.5rem 1rem;
}
#piano-app button[hidden] {
    display: none;
}
#piano-status {
    font-size: 0.8rem;
    min-width: 0;
}
#piano-status:empty {
    display: none;
}
.piano-loop-toggle {
    position: relative;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}
.piano-loop-toggle input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 1;
}
.piano-loop-toggle span {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    border: 1px solid #6a9992;
    border-radius: 9px;
    color: #476963;
    background: white;
    font-size: 0.75rem;
    font-weight: bold;
    line-height: 1;
}
.piano-loop-toggle input:checked + span {
    color: white;
    background: #0f766e;
    border-color: #0f766e;
}
.piano-loop-toggle input:focus-visible + span {
    outline: 3px solid #ad6526;
    outline-offset: 3px;
}
#piano-app details {
    margin: 0.35rem 0;
    border-top: 1px solid #b7dcd6;
}
#piano-app summary {
    font-size: 0.85rem;
    padding: 0.55rem 0;
}
#piano-options .piano-controls {
    padding: 0.6rem 0;
}
@media (max-width: 650px) {
    .piano-transport {
        display: grid;
        grid-template-columns: auto auto 40px auto;
        gap: 0.4rem;
        justify-content: start;
    }
    #piano-app .piano-transport button {
        padding-inline: 0.5rem;
        font-size: 0.8rem;
        white-space: nowrap;
    }
    .piano-transport label {
        gap: 0.2rem;
        white-space: nowrap;
    }
    #piano-tempo {
        width: 52px !important;
        padding-inline: 0.25rem !important;
    }
    #piano-status {
        grid-column: 1 / -1;
    }
    .piano-selection {
        gap: 0.5rem;
    }
    .piano-selection label {
        flex-direction: row;
        align-items: center;
        gap: 0.2rem;
    }
    .piano-selection .piano-type {
        flex: 1;
        min-width: 0;
    }
    .piano-selection .piano-type select {
        width: auto !important;
        min-width: 0;
        flex: 1;
    }
    .piano-score-card {
        padding: 0.4rem;
    }
}
.piano-toast {
    position: fixed;
    right: max(1rem, env(safe-area-inset-right));
    bottom: max(1rem, env(safe-area-inset-bottom));
    z-index: 10000;
    max-width: calc(100vw - 2rem);
    padding: 0.8rem 1rem;
    border-radius: 0.6rem;
    background: #134e4a;
    color: #fff;
    font-size: 0.9rem;
    line-height: 1.5;
    box-shadow: 0 4px 16px #0003;
    pointer-events: none;
}
.piano-toast:empty {
    padding: 0;
    box-shadow: none;
}
