/* Digital Greenhouse — piano-play-along.css
   /tools/piano-play-along. The player itself is always dark with the music on
   cream paper, whatever the site theme; the list of pieces follows the theme. */

section.pa-section { padding-top: clamp(12px, 2vw, 22px); }
.pa-wrap { max-width: 1240px; margin-inline: auto; }
.pa [hidden], .pa-picker [hidden] { display: none !important; }

.pa {
  --pa-rh: #1560c4; --pa-rh-soft: #cfe2fb;
  --pa-lh: #8a3bbd; --pa-lh-soft: #ecd9f8;
  --pa-good: #2b8a3e; --pa-slip: #d9730d; --pa-bad: #c92a2a;
  --pa-paper: #fffdf8; --pa-ink: #1b1b1b;
  border-radius: 18px; overflow: clip; color: #e9efe9;
  background: linear-gradient(180deg, #23292d 0%, #14181b 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 22px 46px -30px rgba(5, 12, 9, 0.6);
  -webkit-user-select: none; user-select: none;
}

/* ---------- Top row: the piece, and the piano connection ---------- */
.pa-top { display: flex; align-items: center; gap: 8px 10px; padding: 10px 14px; flex-wrap: wrap; }
.pa-now { min-width: 0; flex: 1 1 220px; display: flex; flex-direction: column; gap: 2px; padding: 0 4px; }
.pa-now__title { font: 700 1.12rem/1.2 var(--font-display, Georgia, serif); color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pa-now__meta { font-size: 0.78rem; color: #a9b8ae; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pa-ico, .pa-btn, .pa-tog, .pa-seg button {
  font: 600 0.86rem/1 var(--font-sans, system-ui); color: #e9efe9; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.18); background: rgba(255, 255, 255, 0.06);
  height: 38px; padding: 0 13px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; white-space: nowrap;
}
.pa-ico { width: 38px; padding: 0; flex: 0 0 auto; }
.pa-ico svg, .pa-btn svg { width: 17px; height: 17px; fill: currentColor; flex: 0 0 auto; }
.pa-ico:hover, .pa-btn:hover, .pa-tog:hover, .pa-seg button:hover { background: rgba(255, 255, 255, 0.14); }
.pa-ico:disabled { opacity: 0.35; cursor: default; }
.pa button:focus-visible, .pa a:focus-visible, .pa summary:focus-visible, .pa-picker button:focus-visible { outline: 3px solid #9be3bf; outline-offset: 2px; }
.pa-btn--main { background: var(--color-emerald, #0E5C3A); border-color: #2f9e6a; color: #fff; }
.pa-btn--main:hover { background: #12714a; }
.pa-midi::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: #7c8a82; flex: 0 0 auto; }
.pa-midi[data-state="on"] { border-color: #58b98b; background: rgba(63, 179, 127, 0.16); }
.pa-midi[data-state="on"]::before { background: #4fd28f; box-shadow: 0 0 0 4px rgba(79, 210, 143, 0.22); }
.pa-midi[data-state="wait"]::before { background: #e0b24a; }
.pa-midi span { overflow: hidden; text-overflow: ellipsis; max-width: 16rem; }

/* ---------- The stage: paper, staff lines, the sliding music ---------- */
.pa-play { position: relative; }
.pa-stage { position: relative; overflow: hidden; background: var(--pa-paper); color: var(--pa-ink); min-height: 150px; touch-action: pan-y; }
.pa-stage::after { content: ""; position: absolute; inset: 0; z-index: 4; pointer-events: none; box-shadow: inset 0 0 0 0 rgba(201, 42, 42, 0); }
.pa-stage--oops::after { animation: pa-oops 0.45s ease-out; }
@keyframes pa-oops { 0% { box-shadow: inset 0 0 0 7px rgba(201, 42, 42, 0.85); } 100% { box-shadow: inset 0 0 0 7px rgba(201, 42, 42, 0); } }
.pa-prog { position: absolute; left: 0; top: 0; height: 4px; width: 100%; background: var(--color-sprout, #3FB37F); transform: scaleX(0); transform-origin: 0 0; z-index: 6; opacity: 0.85; }
.pa-lines { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.pa-lines i { position: absolute; left: 0; right: 0; height: 1px; background: var(--pa-ink); }
.pa-track { position: absolute; left: 0; top: 0; z-index: 1; transform-origin: 0 0; will-change: transform; }
.pa-track svg, .pa-clef svg { display: block; max-width: none; flex: none; }
.pa-track svg { overflow: visible; }
.pa-track .abcjs-staff path { visibility: hidden; }   /* .pa-lines draws them, right across the stage */
/* the pinned copy (.pa-clef) shows the clef, time signature, brace and the line that joins the staves */
.pa-track .abcjs-staff-extra, .pa-track .abcjs-brace, .pa-track .abcjs-bracket, .pa-track .abcjs-staff-wrapper > path:not([class]) { visibility: hidden; }
.pa-track .abcjs-note { cursor: pointer; }
.pa-clef { position: absolute; left: 0; top: 0; bottom: 0; z-index: 2; overflow: hidden; background: var(--pa-paper); box-shadow: 16px 0 14px -8px var(--pa-paper); pointer-events: none; }
.pa-head { position: absolute; top: 0; bottom: 0; width: 0; z-index: 3; pointer-events: none; }
.pa-head::before { content: ""; position: absolute; top: 0; bottom: 0; left: -2px; width: 4px; border-radius: 2px; background: rgba(14, 92, 58, 0.55); }
.pa-head::after { content: ""; position: absolute; top: 0; bottom: 0; left: -26px; width: 52px; background: linear-gradient(90deg, rgba(63, 179, 127, 0), rgba(63, 179, 127, 0.16), rgba(63, 179, 127, 0)); }

/* the notes as you play them */
.pa-track .pa-lit path, .pa-track .pa-lit text { fill: var(--pa-rh); stroke: var(--pa-rh); }
.pa-track .pa-lit.pa-lit-lh path, .pa-track .pa-lit.pa-lit-lh text { fill: var(--pa-lh); stroke: var(--pa-lh); }
.pa-track .pa-hit path, .pa-track .pa-hit text { fill: var(--pa-good); stroke: var(--pa-good); }
.pa-track .pa-slip path, .pa-track .pa-slip text { fill: var(--pa-slip); stroke: var(--pa-slip); }
.pa-track .pa-miss path, .pa-track .pa-miss text { fill: var(--pa-bad); stroke: var(--pa-bad); }
.pa-track .abcjs-lyric { font-weight: 700; }

.pa-count { position: absolute; z-index: 5; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 1.5em; height: 1.5em; display: grid; place-items: center; border-radius: 50%; font: 800 clamp(3.2rem, 11vw, 5.5rem)/1 var(--font-display, Georgia, serif); color: #fff; background: rgba(14, 92, 58, 0.92); box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5); pointer-events: none; }
.pa-count--pop { animation: pa-pop 0.32s ease-out; }
@keyframes pa-pop { from { transform: translate(-50%, -50%) scale(1.5); opacity: 0.2; } to { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
.pa-toast { position: absolute; z-index: 7; left: 50%; bottom: 10px; transform: translateX(-50%); max-width: min(92%, 34rem); padding: 8px 14px; border-radius: 10px; background: #1b2023; color: #fff; font-size: 0.86rem; line-height: 1.35; text-align: center; box-shadow: 0 8px 20px -8px rgba(0, 0, 0, 0.5); }
.pa-toast--bad { background: #7a1f1f; }

/* ---------- The result card ---------- */
.pa-result { position: absolute; inset: 0; z-index: 9; display: grid; place-items: center; padding: 12px; background: rgba(255, 253, 248, 0.9); overflow: auto; }
.pa-result__card { width: min(100%, 30rem); padding: 18px 20px 20px; border-radius: 16px; background: #fff; color: #1b1b1b; text-align: center; border: 1px solid #e3ddcd; box-shadow: 0 18px 40px -22px rgba(0, 0, 0, 0.45); }
.pa-result__stars { margin: 0; font-size: 2.3rem; line-height: 1; letter-spacing: 0.12em; color: #e0a100; }
.pa-result__card h3 { margin: 8px 0 4px; font: 700 1.4rem/1.2 var(--font-display, Georgia, serif); color: #0E5C3A; }
.pa-result__line { margin: 0; font-size: 0.98rem; color: #333; }
.pa-result__tip { margin: 8px 0 0; font-size: 0.88rem; color: #5b5b55; }
.pa-result__row { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 14px; }
.pa-result .pa-btn { color: #0E5C3A; border-color: #0E5C3A; background: #fff; }
.pa-result .pa-btn:hover { background: #eef6f1; }
.pa-result .pa-btn--main { color: #fff; background: #0E5C3A; }
.pa-result .pa-btn--main:hover { background: #12714a; }

/* ---------- The keyboard ---------- */
.pa-kbwrap { background: #0f1214; padding: 6px 8px 0; border-top: 3px solid #7a1f1f; overflow-x: auto; }
.pa-kb { position: relative; height: clamp(104px, 19vh, 168px); min-width: calc(var(--pa-whites, 15) * 17px); margin-inline: auto; max-width: calc(var(--pa-whites, 15) * 56px); touch-action: none; }
.pa-key { position: absolute; top: 0; box-sizing: border-box; cursor: pointer; }
.pa-key--w { height: 100%; background: linear-gradient(180deg, #f4f4f0 0%, #ffffff 16%, #f3f2ee 100%); border: 1px solid #a9a9a1; border-top: 0; border-radius: 0 0 6px 6px; z-index: 1; color: #55554f; }
.pa-key--b { height: 62%; background: linear-gradient(180deg, #2c2c30 0%, #121214 100%); border-radius: 0 0 4px 4px; z-index: 2; box-shadow: 0 2px 3px rgba(0, 0, 0, 0.5); color: #d9d9d9; }
.pa-key span { position: absolute; left: 0; right: 0; text-align: center; pointer-events: none; }
.pa-key__name { bottom: 5px; font: 700 0.72rem/1 var(--font-sans, system-ui); }
.pa-key--mid .pa-key__name { color: #0E5C3A; }
.pa-key--mid.pa-key--w::after { content: ""; position: absolute; left: 50%; bottom: 20px; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: #0E5C3A; opacity: 0.55; }
.pa-key__pc { top: 5px; font: 600 0.62rem/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; opacity: 0.75; }
.pa-key--b .pa-key__pc { top: auto; bottom: 30px; opacity: 0.8; }
.pa--midi .pa-key__pc { display: none; }
@media (hover: none) { .pa-key__pc { display: none; } }
.pa-key__fin { bottom: 22px; font: 800 0.95rem/1 var(--font-sans, system-ui); color: #fff; }
.pa-key__fin:empty { display: none; }
.pa-key--b .pa-key__fin { bottom: 7px; font-size: 0.8rem; }
.pa-key--mid.is-now-rh::after, .pa-key--mid.is-now-lh::after { display: none; }

.pa-key.is-now-rh { background: var(--pa-rh); color: #fff; border-color: #0f4a99; }
.pa-key.is-now-lh { background: var(--pa-lh); color: #fff; border-color: #6a2b94; }
.pa-key.is-now-rh .pa-key__name, .pa-key.is-now-lh .pa-key__name { color: #fff; }
.pa-key--w.is-next-rh { background: var(--pa-rh-soft); box-shadow: inset 0 0 0 3px var(--pa-rh); }
.pa-key--w.is-next-lh { background: var(--pa-lh-soft); box-shadow: inset 0 0 0 3px var(--pa-lh); }
.pa-key--b.is-next-rh { box-shadow: inset 0 0 0 3px var(--pa-rh); }
.pa-key--b.is-next-lh { box-shadow: inset 0 0 0 3px var(--pa-lh); }
.pa-key.is-next-rh .pa-key__fin { color: var(--pa-rh); }
.pa-key.is-next-lh .pa-key__fin { color: var(--pa-lh); }
.pa-key--w.is-auto { background: #d5dbd7; }
.pa-key--b.is-auto { background: #5a6168; }
.pa-key.is-down { filter: brightness(0.86); }
.pa-key--w.is-down { box-shadow: inset 0 6px 8px -4px rgba(0, 0, 0, 0.45); }
.pa-key.is-good { animation: pa-good 0.45s ease-out; }
.pa-key.is-bad { animation: pa-bad 0.5s ease-out; }
@keyframes pa-good { 0% { box-shadow: inset 0 0 0 100px rgba(43, 138, 62, 0.95); } 100% { box-shadow: inset 0 0 0 100px rgba(43, 138, 62, 0); } }
@keyframes pa-bad { 0% { box-shadow: inset 0 0 0 100px rgba(201, 42, 42, 0.95); } 100% { box-shadow: inset 0 0 0 100px rgba(201, 42, 42, 0); } }

/* ---------- Controls ---------- */
.pa-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; padding: 14px; }
.pa-go { flex: 0 0 auto; height: 52px; min-width: 9.5rem; padding: 0 22px 0 16px; border-radius: 999px; border: 0; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 10px; font: 700 1rem/1 var(--font-sans, system-ui); color: #fff; background: var(--color-emerald, #0E5C3A); box-shadow: 0 6px 16px -6px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.25); }
.pa-go:hover { background: #12714a; }
.pa-go svg { width: 20px; height: 20px; fill: currentColor; }
.pa-go .pa-go__pause { display: none; }
.pa[data-state="run"]:not([data-mode="wait"]) .pa-go .pa-go__pause { display: block; }
.pa[data-state="run"]:not([data-mode="wait"]) .pa-go .pa-go__play { display: none; }
.pa-group { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.pa-group > span { font-size: 0.68rem; letter-spacing: 0.06em; text-transform: uppercase; color: #9fb0a6; }
.pa-seg { display: inline-flex; border-radius: 10px; }
.pa-seg button { border-radius: 0; margin-left: -1px; }
.pa-seg button:first-child { border-radius: 10px 0 0 10px; margin-left: 0; }
.pa-seg button:last-child { border-radius: 0 10px 10px 0; }
.pa-seg button[aria-pressed="true"], .pa-tog[aria-pressed="true"] { background: #2f7d5b; border-color: #58b98b; color: #fff; position: relative; z-index: 1; }
.pa-togs { display: flex; flex-wrap: wrap; gap: 8px; }
.pa-more { flex: 1 1 100%; font-size: 0.86rem; color: #c9d4cc; }
.pa-more summary { cursor: pointer; width: max-content; color: #a9b8ae; font-weight: 600; }
.pa-more__body { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding-top: 10px; }
.pa-more label { display: inline-flex; align-items: center; gap: 8px; }
.pa-more input[type="range"] { accent-color: #58b98b; width: 9rem; }
.pa-more a { color: #9be3bf; }
.pa-hint { margin: 0; padding: 0 16px 14px; min-height: 1.4em; font-size: 0.92rem; color: #c3d0c7; }

/* ---------- Full screen ---------- */
.pa--fs, .pa--full { display: flex; flex-direction: column; justify-content: center; border-radius: 0; border: 0; background: #14181b; }
.pa--full { position: fixed; inset: 0; z-index: 2000; overflow: auto; }
.pa--fs .pa-kb, .pa--full .pa-kb { height: clamp(120px, 24vh, 220px); }

/* ---------- The list of pieces (follows the site theme) ---------- */
.pa-picker { margin-top: var(--space-6, 2rem); scroll-margin-top: 90px; }
.pa-picker h2 { font-size: var(--fs-2xl, 1.7rem); margin: 0 0 var(--space-2, 0.5rem); }
.pa-picker > p { margin: 0 0 var(--space-4, 1rem); color: var(--text-muted, #5b6b62); }
.pa-levels { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin-bottom: var(--space-4, 1rem); }
.pa-level { display: flex; flex-direction: column; gap: 3px; text-align: left; padding: 10px 12px; border-radius: 12px; cursor: pointer; font: inherit; color: var(--text, #0B1F17); background: var(--bg-card, #fff); border: 1px solid var(--color-line, #d8e2db); }
.pa-level:hover { border-color: var(--color-sprout, #3FB37F); }
.pa-level[aria-pressed="true"] { background: var(--color-emerald, #0E5C3A); border-color: var(--color-emerald, #0E5C3A); color: #fff; }
.pa-level__n { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.75; }
.pa-level__name { font-weight: 700; line-height: 1.2; }
.pa-level__count { font-size: 0.78rem; opacity: 0.75; }
.pa-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.pa-piece { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; text-align: left; padding: 10px 12px; border-radius: 12px; cursor: pointer; font: inherit; color: var(--text, #0B1F17); background: var(--bg-card, #fff); border: 1px solid var(--color-line, #d8e2db); }
.pa-piece:hover { border-color: var(--color-sprout, #3FB37F); }
.pa-piece[aria-current="true"] { border-color: var(--color-sprout, #3FB37F); box-shadow: inset 0 0 0 2px var(--color-sprout, #3FB37F); }
.pa-piece__title { font-weight: 700; line-height: 1.25; }
.pa-piece__meta { grid-column: 1; font-size: 0.78rem; color: var(--text-muted, #5b6b62); }
.pa-piece__stars { grid-column: 2; grid-row: 1 / span 2; font-size: 0.95rem; letter-spacing: 0.08em; color: #c98f00; white-space: nowrap; }
[data-theme="dark"] .pa-piece__stars { color: #e7bd4f; }
[data-theme="dark"] .pa-level[aria-pressed="true"] { background: var(--color-sprout, #3FB37F); border-color: var(--color-sprout, #3FB37F); color: #0B1F17; }

.pa-about { margin-top: var(--space-7, 3rem); }
.pa-about .crumb { margin-bottom: var(--space-2, 0.5rem); }
.prose .pa-steps, .pa-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--space-4, 1rem); margin: var(--space-4, 1rem) 0; padding: 0; list-style: none; counter-reset: pa; }
.prose .pa-steps li, .pa-steps li { counter-increment: pa; margin: 0; padding: var(--space-4, 1rem); border-radius: var(--radius, 14px); background: var(--bg-card, #fff); border: 1px solid var(--color-line, #d8e2db); }
.pa-steps li::before { content: counter(pa); display: grid; place-items: center; width: 30px; height: 30px; margin-bottom: 8px; border-radius: 50%; background: var(--color-emerald, #0E5C3A); color: #fff; font-weight: 700; }
.pa-steps strong { display: block; margin-bottom: 4px; }

@media (max-width: 720px) {
  .pa { border-radius: 12px; }
  .pa-top { padding: 8px 10px; }
  .pa-now { flex-basis: 100%; order: -1; }
  .pa-bar { gap: 10px 12px; padding: 12px 10px; }
  .pa-go { height: 46px; min-width: 8rem; }
  .pa-ico, .pa-btn, .pa-tog, .pa-seg button { height: 36px; padding: 0 10px; font-size: 0.82rem; }
  .pa-ico { padding: 0; }
  .pa-kb { height: 118px; }
  .pa-hint { padding: 0 12px 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .pa-count--pop, .pa-key.is-good, .pa-key.is-bad { animation-duration: 0.01s; }
  .pa-stage--oops::after { animation: none; box-shadow: inset 0 0 0 7px rgba(201, 42, 42, 0.85); }
}
@media print { .pa, .pa-picker { display: none; } }
