/* Echo Keys — the card on the study page and the full-screen game over it
   (dist/games/piano/piano.js). No web fonts, no images: system fonts, and
   the board itself is drawn on a canvas. */

/* ---- the card on the page ---- */
.pn-card { margin: 18px 0; padding: 16px 16px 14px; border-radius: 16px; color: #fff;
  background: linear-gradient(135deg, #2b2466 0%, #3f35a3 60%, #4f46e5 100%); box-shadow: 0 6px 18px rgba(43, 36, 102, .25); }
.pn-card[hidden] { display: none; }
.pn-card.pn-locked { background: linear-gradient(135deg, #4b4a63 0%, #5f5d7a 100%); }
.pn-card-head { display: flex; align-items: center; gap: 12px; }
.pn-card-keys { display: flex; gap: 3px; flex: 0 0 auto; }
.pn-card-keys i { display: block; width: 9px; height: 30px; border-radius: 0 0 4px 4px; }
section.pn-card .pn-card-title { margin: 0; font-size: 22px; line-height: 1.2; font-weight: 800; color: #fff; }
.pn-card-sub, .pn-card-rule { margin: 8px 0 0; font-size: 16px; line-height: 1.4; }
.pn-card-rule { color: #fde68a; font-weight: 600; }
.pn-card .pn-open { display: block; width: 100%; min-height: 56px; margin: 12px 0 8px; border: 0; border-radius: 14px;
  background: #facc15; color: #1d1b26; font-size: 20px; font-weight: 800; box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .18);
  -webkit-appearance: none; appearance: none; font-family: inherit; }
.pn-card .pn-open:disabled { background: #d4d4dc; color: #4b4a63; box-shadow: none; }
.pn-card-note { margin: 0; font-size: 14px; line-height: 1.45; color: #e0e7ff; }
.pn-card-note a { color: #fde68a; font-weight: 700; }

/* ---- the game ---- */
html.pn-lock, html.pn-lock body { overflow: hidden !important; }
.pn-root { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 2147483000; display: flex; flex-direction: column;
  background: #121216; color: #fff; font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  font-size: 18px; line-height: 1.35; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent; overflow: hidden; }
.pn-root[hidden] { display: none; }
.pn-root button { font-family: inherit; -webkit-appearance: none; appearance: none; touch-action: manipulation; cursor: pointer; }
.pn-root button:focus-visible { outline: 3px solid #fde68a; outline-offset: 2px; }
.pn-top { flex: 0 0 auto; position: relative; z-index: 6; display: flex; align-items: center; gap: 10px; min-height: 58px;
  padding: 7px 10px; padding-top: max(7px, env(safe-area-inset-top)); background: #1b1b22; border-bottom: 1px solid rgba(255, 255, 255, .06); }
.pn-top[hidden] { display: none; }
.pn-top button { flex: 0 0 auto; min-width: 52px; min-height: 44px; padding: 0 14px; border: 0; border-radius: 12px;
  background: rgba(255, 255, 255, .12); color: #fff; font-size: 20px; font-weight: 800; }
.pn-title { flex: 1 1 auto; min-width: 0; font-size: 20px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pn-meta { flex: 0 0 auto; font-size: 16px; font-weight: 700; color: #fde68a; white-space: nowrap; }
.pn-body { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; position: relative; overflow: hidden; }
.pn-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  padding: 16px 16px 28px; touch-action: pan-y; }

/* the menu: speed on top, the rule line, this week's lesson, then the songs */
.pn-speeds { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin: 0 0 12px; }
.pn-speed { display: flex; align-items: center; justify-content: center; min-height: 64px; padding: 6px 8px;
  border: 3px solid rgba(255, 255, 255, .22); border-radius: 18px; background: #26262f; color: #fff; }
.pn-speed-name { font-size: 21px; font-weight: 900; white-space: nowrap; }
.pn-speed.on { border-color: #facc15; background: #3a3420; }
.pn-rule { margin: 0 0 14px; font-size: 17px; font-weight: 700; color: #fde68a; }
.pn-list-head { margin: 16px 2px 8px; font-size: 22px; font-weight: 800; }
.pn-rows { display: grid; gap: 10px; }
.pn-row { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 12px; padding: 10px 12px;
  border-radius: 18px; background: linear-gradient(90deg, #262631 0%, #1f1f28 100%); border: 1px solid rgba(255, 255, 255, .07); }
.pn-pic { display: flex; align-items: center; justify-content: center; width: 64px; height: 64px; border-radius: 16px; font-size: 36px;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .25); }
.pn-pic-big { width: 96px; height: 96px; border-radius: 50%; font-size: 54px; }
.pn-row-info { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; min-height: 64px; padding: 4px 6px;
  border: 0; border-radius: 12px; background: transparent; color: #fff; text-align: left; }
.pn-row-title { font-size: 21px; font-weight: 800; line-height: 1.2; }
.pn-row-origin { font-size: 15px; color: #b7b7c6; }
.pn-row-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 15px; }
.pn-diff { font-weight: 800; letter-spacing: .06em; text-transform: uppercase; font-size: 13px; }
.pn-diff-easy { color: #86efac; }
.pn-diff-normal { color: #7dd3fc; }
.pn-diff-hard { color: #fca5a5; }
.pn-stars { color: #fbbf24; font-size: 18px; letter-spacing: 1px; }
.pn-row-level { color: #d4d4de; font-weight: 700; }
.pn-learn, .pn-play { min-width: 104px; min-height: 52px; padding: 0 16px; border: 0; border-radius: 26px; font-size: 19px; font-weight: 900; }
.pn-learn { background: linear-gradient(180deg, #34d399, #10b981); color: #062a1e; }
.pn-play { background: linear-gradient(180deg, #ffc27a, #ff9f45); color: #3a1a00; }
.pn-next-head { color: #fde68a; }
.pn-next-note { margin: -4px 2px 10px; font-size: 16px; font-weight: 700; color: #e5e0cf; }
.pn-row-next { border: 2px solid #fbbf24; background: linear-gradient(90deg, #332b17 0%, #231f16 100%); }
.pn-next-tag { font-size: 13px; font-weight: 900; letter-spacing: .04em; color: #fcd34d; }
.pn-learn-first { box-shadow: 0 0 0 3px #fde68a, 0 0 16px rgba(52, 211, 153, .6); }
.pn-next-line { margin: -4px 0 12px; font-size: 17px; font-weight: 800; color: #fde68a; }
.pn-lesson-entry { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; min-height: 84px; padding: 12px 16px;
  border: 3px solid #fbbf24; border-radius: 18px; background: #2d2716; color: #fff; text-align: left; }
.pn-lesson-kicker { font-size: 15px; font-weight: 800; color: #fcd34d; }
.pn-lesson-name { font-size: 22px; font-weight: 900; }
.pn-lesson-state { font-size: 15px; color: #e5e0cf; }

/* a song's screen */
.pn-song-head { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }
.pn-song-title { margin: 0; font-size: 26px; font-weight: 900; }
.pn-song-origin, .pn-song-best { margin: 2px 0 0; font-size: 16px; color: #c9c9d6; }
.pn-song-best { color: #fbbf24; }
.pn-mode-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 4px; }
.pn-big { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 128px;
  padding: 14px; border: 0; border-radius: 22px; color: #1d1b26; box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .22); }
.pn-go-learn { background: linear-gradient(180deg, #34d399, #10b981); }
.pn-go-play { background: linear-gradient(180deg, #ffc27a, #ff9f45); }
.pn-big-title { font-size: 30px; font-weight: 900; }
.pn-big small { font-size: 16px; font-weight: 700; }
.pn-mode-note { margin: 16px 0 0; font-size: 16px; color: #c9c9d6; }
.pn-levels { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; margin-top: 14px; }
.pn-lvl { min-height: 48px; min-width: 120px; padding: 0 16px; border: 2px solid rgba(255, 255, 255, .35); border-radius: 14px;
  background: transparent; color: #fff; font-size: 17px; font-weight: 800; }
.pn-lvl:disabled { opacity: .35; }
.pn-lvl-now { font-size: 16px; font-weight: 700; color: #c9c9d6; }
.pn-low-note { margin: 6px 0 6px; font-size: 16px; font-weight: 700; color: #bef264; }
.pn-lowrow { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.pn-low { min-height: 52px; border: 3px solid rgba(255, 255, 255, .22); border-radius: 16px; background: #26262f; color: #fff; font-size: 18px; font-weight: 800; }
.pn-low.on { border-color: #bef264; background: #2c3319; }

/* the board: one canvas over everything, the ⏸ and "Hear it again" above it */
.pn-board { position: absolute; top: 0; right: 0; bottom: 0; left: 0; z-index: 3; background: #121214; overflow: hidden; }
.pn-board[hidden] { display: none; }
.pn-canvas { position: absolute; top: 0; left: 0; display: block; touch-action: none; -webkit-user-select: none; user-select: none; }
.pn-pause { position: absolute; z-index: 4; top: max(10px, env(safe-area-inset-top)); left: max(10px, env(safe-area-inset-left));
  width: 56px; height: 56px; border: 0; border-radius: 14px; background: rgba(255, 255, 255, .1); color: #fff; font-size: 26px; font-weight: 900; }
.pn-hear { position: absolute; z-index: 4; top: max(10px, env(safe-area-inset-top)); right: max(10px, env(safe-area-inset-right));
  min-height: 52px; padding: 0 18px; border: 2px solid rgba(255, 255, 255, .45); border-radius: 16px; background: rgba(0, 0, 0, .35);
  color: #fff; font-size: 18px; font-weight: 800; }
.pn-hear[hidden] { display: none; }

/* ---- sheets: the question, the pause, the results, the rotate card, the lesson ---- */
.pn-sheet { position: absolute; top: 0; right: 0; bottom: 0; left: 0; z-index: 7; display: flex; align-items: center; justify-content: center;
  padding: 16px; background: transparent; }
.pn-sheet[hidden] { display: none; }
.pn-panel { width: 100%; max-width: 660px; max-height: 100%; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 18px 18px 20px;
  border-radius: 22px; background: #fffaf2; color: #1d1b26; box-shadow: 0 20px 60px rgba(0, 0, 0, .55); -webkit-user-select: text; user-select: text; }
.pn-q-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 10px; }
.pn-chip { padding: 5px 12px; border-radius: 999px; background: #fdecc8; color: #7a4a00; font-size: 16px; font-weight: 800; }
.pn-q-why { margin: 8px 0 0; font-size: 16px; font-weight: 700; color: #5b5670; }
.pn-speak { min-width: 52px; min-height: 48px; border: 0; border-radius: 12px; background: #ede9fe; font-size: 22px; }
.pn-prompt { margin: 12px 0 16px; font-size: clamp(22px, 4vw, 30px); font-weight: 800; line-height: 1.3; overflow-wrap: anywhere; }
.pn-choices { display: grid; gap: 10px; }
.pn-choice { min-height: 64px; padding: 8px 14px; border: 3px solid #d9d4e6; border-radius: 16px; background: #fff; color: #1d1b26;
  font-size: 24px; font-weight: 800; overflow-wrap: anywhere; }
.pn-choice.crossed { text-decoration: line-through; opacity: .45; }
/* the first moment of a question, while taps meant for the keys are ignored */
.pn-problem.pn-wait .pn-choice { opacity: .5; }
.pn-choice.right { border-color: #16a34a; background: #dcfce7; }
.pn-hint { margin: 14px 0 0; padding: 10px 14px; border-radius: 12px; background: #fff3d6; color: #7c3a06; font-size: 19px; font-weight: 600; }
.pn-hint[hidden] { display: none; }
.pn-hint.pn-yes { background: #dcfce7; color: #14532d; font-weight: 800; }
.pn-continue, .pn-songs-btn, .pn-next, .pn-restart { min-height: 60px; width: 100%; margin-top: 10px; border: 0; border-radius: 16px; background: #ff9f45; color: #3a1a00;
  font-size: 21px; font-weight: 900; }
.pn-next { background: #34d399; color: #062a1e; }
.pn-songs-btn, .pn-restart { background: #ede9fe; color: #3f35a3; }
.pn-continue.pn-try-faster { background: #15803d; color: #fff; }
.pn-done { text-align: center; }
.pn-ring { position: relative; display: block; width: 200px; height: 190px; margin: 0 auto; }
.pn-ring .pn-pic-big { position: absolute; left: 52px; top: 48px; z-index: 1; }
.pn-ring::before { content: ""; position: absolute; left: 36px; top: 32px; width: 128px; height: 128px; border-radius: 50%;
  border: 6px solid #fbbf24; border-bottom-color: transparent; box-sizing: border-box; }
.pn-ring-star { position: absolute; z-index: 2; width: 38px; height: 38px; font-size: 36px; line-height: 38px; text-align: center; color: #d6d3e0;
  text-shadow: 0 1px 0 rgba(0, 0, 0, .15); }
.pn-ring-star.on { color: #fbbf24; animation: pn-pop .35s ease-out both; }
@keyframes pn-pop { 0% { transform: scale(.2); opacity: 0; } 70% { transform: scale(1.3); opacity: 1; } 100% { transform: scale(1); } }
.pn-done-title { margin: 6px 0 2px; font-size: 26px; font-weight: 900; }
.pn-score { margin: 0; font-size: 44px; font-weight: 900; color: #e07b12; font-variant-numeric: tabular-nums; }
.pn-tally { display: flex; justify-content: center; gap: 24px; margin: 4px 0; }
.pn-tally-cell { display: flex; flex-direction: column; align-items: center; }
.pn-tally-cell b { font-size: 26px; }
.pn-tally-cell small { font-size: 14px; color: #5b5670; font-weight: 700; }
.pn-done-misses, .pn-best { margin: 4px 0; font-size: 18px; font-weight: 700; }
.pn-newbest { color: #b45309; font-size: 21px; }
.pn-done-energy { margin: 6px 0; font-size: 22px; font-weight: 900; color: #4338ca; }
.pn-done-energy.pn-unpaid { font-size: 18px; font-weight: 700; color: #5b5670; }
.pn-done-stats, .pn-done-level { margin: 6px 0; font-size: 18px; }
.pn-done-btns { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.pn-paused h3, .pn-rotate h3 { margin: 0 0 8px; font-size: 24px; }
.pn-paused p, .pn-rotate p { margin: 0 0 6px; font-size: 18px; }
.pn-rotate { text-align: center; }
.pn-rotate-icon { font-size: 48px; margin: 0 !important; }
/* the lesson's panel stops above its keys and finger numbers (--pn-kb: the keyboard's height), so touches reach the keys */
.pn-sheet-lesson { align-items: flex-start; bottom: calc(var(--pn-kb, 0px) + 80px); }
.pn-lesson-p { bottom: calc(var(--pn-kb, 0px) + 12px); }
.pn-lesson .pn-choices { grid-template-columns: repeat(3, 1fr); }
.pn-lesson { max-width: 820px; background: #fffdf5; }
.pn-lesson .pn-lesson-kicker { margin: 0 0 6px; color: #92400e; }
.pn-lesson-text { margin: 4px 0 8px; font-size: clamp(20px, 3vw, 26px); font-weight: 700; line-height: 1.35; }
.pn-lesson-count { margin: 0; font-size: 16px; font-weight: 800; color: #92400e; }
.pn-lesson-play { font-size: 18px; font-weight: 700; color: #5b5670; }
.pn-lesson-read, .pn-lesson-again { min-height: 60px; margin-top: 10px; border: 0; border-radius: 16px; background: #ede9fe; color: #3f35a3; font-size: 20px; font-weight: 900; }
.pn-sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (min-width: 700px) {
  .pn-choices { grid-template-columns: repeat(3, 1fr); }
  .pn-choice { min-height: 80px; }
}
@media (max-width: 620px) {
  .pn-row { grid-template-columns: auto 1fr; }
  .pn-learn, .pn-play { width: 100%; }
  .pn-pic { width: 56px; height: 56px; font-size: 30px; }
  .pn-row-title { font-size: 19px; }
  .pn-mode-btns { grid-template-columns: 1fr; }
  .pn-done-btns { grid-template-columns: 1fr; }
  .pn-speed-name { font-size: 18px; }
  .pn-meta { font-size: 14px; }
}
/* a phone on its side: less chrome */
@media (max-height: 460px) {
  .pn-top { min-height: 48px; padding: 4px 10px; }
  .pn-sheet { padding: 8px; }
  .pn-prompt { margin: 8px 0 10px; font-size: 21px; }
  .pn-choice { min-height: 52px; font-size: 20px; }
  .pn-ring { transform: scale(.72); transform-origin: 50% 20%; height: 140px; }
  .pn-continue, .pn-songs-btn, .pn-next, .pn-restart { min-height: 52px; font-size: 19px; }
  /* the results side by side, so the stars round the picture and the buttons both fit */
  .pn-done { display: grid; grid-template-columns: 150px 1fr; column-gap: 14px; align-items: center; max-width: 820px; padding: 10px 14px 12px; }
  .pn-done > * { grid-column: 2; }
  .pn-done > .pn-ring { grid-column: 1; grid-row: 1 / span 8; margin: 0 0 0 -25px; transform-origin: 50% 50%; }
  .pn-done-title { margin: 0; font-size: 21px; }
  .pn-score { font-size: 32px; }
  .pn-done-misses, .pn-best, .pn-done-energy, .pn-done-energy.pn-unpaid, .pn-done-stats, .pn-done-level { margin: 2px 0; font-size: 15px; }
  .pn-tally-cell b { font-size: 20px; }
  .pn-done-btns { grid-template-columns: 1fr 1fr 1fr; }
  /* the lesson: its words left, its buttons right */
  .pn-lesson { display: grid; grid-template-columns: 1fr 250px; column-gap: 14px; align-items: start; padding: 10px 14px; }
  .pn-lesson > * { grid-column: 1; }
  .pn-lesson > .pn-done-btns { grid-column: 2; grid-row: 1 / span 3; grid-template-columns: 1fr; gap: 6px; }
  .pn-lesson .pn-done-btns button { min-height: 46px; margin: 0; }
  .pn-lesson-text { margin: 2px 0; font-size: 18px; }
  .pn-lesson .pn-hint { margin-top: 8px; padding: 6px 10px; font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .pn-root *, .pn-card * { transition: none !important; animation: none !important; }
}
