/* RSM Virtual Keyboard
   Brand values live in :root only (from the rsm-brand skill). Change them here.
   Old-Safari rules: no flex `gap`, no `aspect-ratio`, no `inset`. */

:root {
  --rsm-red: #CE0000;
  --rsm-red-dark: #8A0000;
  --rsm-black: #000000;
  --rsm-cream: #EBE1CC;
  --rsm-blush: #FFEFEF;
  --rsm-bg: #FAFAFA;
  --rsm-surface: #FFFFFF;
  --rsm-text: #333333;
  --rsm-muted: #767676;
  --rsm-line: #E5E5E5;
  --rsm-font-display: 'Montserrat', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --rsm-font-body: 'Noto Sans', 'Segoe UI', Roboto, Arial, sans-serif;

  /* Keyboard */
  --case: #141414;
  --key-white-lip: #E9E9E9;
  --key-black: #1B1B1B;
  --key-black-lip: #3C3C3C;
  --arrow-h: 40px;
  --bar-h: 52px;
}

/* Brand fonts are used if installed on the device; nothing is downloaded. */
@font-face { font-family: 'Montserrat'; src: local('Montserrat'), local('Montserrat-Regular'); font-weight: 400; }
@font-face { font-family: 'Montserrat'; src: local('Montserrat SemiBold'), local('Montserrat-SemiBold'); font-weight: 600; }
@font-face { font-family: 'Montserrat'; src: local('Montserrat Bold'), local('Montserrat-Bold'); font-weight: 700; }
@font-face { font-family: 'Noto Sans'; src: local('Noto Sans'), local('NotoSans-Regular'); font-weight: 400; }

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--rsm-bg);
  color: var(--rsm-text);
  font-family: var(--rsm-font-body);
  font-size: 17px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--rsm-black); outline-offset: 3px; }

/* ---------- Main screen ---------- */
.main {
  position: absolute;
  top: 0; right: 0; left: 0;
  height: 100vh;
  height: calc(var(--vh, 1vh) * 100);
  display: -webkit-flex; display: flex;
  -webkit-flex-direction: column; flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  overflow: hidden;
}
@supports (height: 100dvh) { .main { height: 100dvh; } }

/* Home: free keyboard on top, songs below; the page scrolls. */
.main.is-home { overflow-y: auto; -webkit-overflow-scrolling: touch; }
.main.is-home > * { -webkit-flex-shrink: 0; flex-shrink: 0; }
.main.is-home .stage {                 /* JS shrinks this to fit the keyboard */
  -webkit-flex: none; flex: none;
  height: 58vh;
  height: calc(var(--vh, 1vh) * 58);
}
.is-home #btn-back, .is-home #btn-restart, .is-home .progress, .is-home #btn-play { display: none; }
.main:not(.is-home) .songs { display: none; }

/* ---------- Top bar ---------- */
.bar {
  display: -webkit-flex; display: flex;
  -webkit-align-items: center; align-items: center;
  height: var(--bar-h);
  padding: 0 6px 0 10px;
  background: var(--rsm-surface);
  border-bottom: 1px solid var(--rsm-line);
  -webkit-flex-shrink: 0; flex-shrink: 0;
}
.ibtn {
  display: -webkit-inline-flex; display: inline-flex;
  -webkit-align-items: center; align-items: center;
  -webkit-justify-content: center; justify-content: center;
  width: 44px; height: 44px;
  border: 0; border-radius: 12px;
  background: transparent;
  color: var(--rsm-black);
  padding: 0;
  -webkit-flex-shrink: 0; flex-shrink: 0;
}
.ibtn svg { width: 24px; height: 24px; display: block; }
.ibtn:active { background: var(--rsm-cream); }
.bar-bm { display: block; width: 17px; height: auto; margin: 0 10px 0 4px; }
.bar-title {
  -webkit-flex: 1; flex: 1;
  min-width: 0;
  margin: 0;
  font-family: var(--rsm-font-display);
  font-weight: 700;
  font-size: 17px;
  color: var(--rsm-black);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.is-home .bar-title { font-weight: 600; }

.progress { height: 8px; background: var(--rsm-line); overflow: hidden; -webkit-flex-shrink: 0; flex-shrink: 0; }
.progress-fill {
  height: 100%;
  background: var(--rsm-red);
  -webkit-transform-origin: 0 50%; transform-origin: 0 50%;
  -webkit-transform: scaleX(0); transform: scaleX(0);
  -webkit-transition: -webkit-transform 0.2s ease-out; transition: transform 0.2s ease-out;
}
.is-demo .progress-fill { background: var(--rsm-black); }

.rotate {
  display: -webkit-flex; display: flex;
  -webkit-align-items: center; align-items: center;
  -webkit-justify-content: center; justify-content: center;
  background: var(--rsm-cream);
  color: var(--rsm-black);
  font-weight: 600;
  font-size: 15px;
  padding: 4px 4px 4px 12px;
  -webkit-flex-shrink: 0; flex-shrink: 0;
}
.rotate-x { border: 0; background: transparent; font-size: 26px; width: 44px; height: 44px; }

/* ---------- Keyboard ---------- */
/* The stage centres the instrument; its size is set in JS (sizeKeyboard). */
.stage {
  -webkit-flex: 1 1 auto; flex: 1 1 auto;
  min-height: 0;
  display: -webkit-flex; display: flex;
  -webkit-align-items: center; align-items: center;
  -webkit-justify-content: center; justify-content: center;
  padding: var(--arrow-h) 6px 6px;
  overflow: hidden;
  -webkit-user-select: none; user-select: none;
}
.case {
  position: relative;
  max-width: 100%;
  background: var(--case);
  border-radius: 16px;
  padding: 14px 12px 12px;
  box-shadow: 0 6px 0 #000;
}
.case::before {                       /* thin red "felt" strip above the keys */
  content: '';
  position: absolute;
  top: 6px; left: 12px; right: 12px;
  height: 4px;
  border-radius: 2px;
  background: var(--rsm-red);
}
.kb {
  position: relative;
  height: 260px;
  display: -webkit-flex; display: flex;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none; user-select: none;
  cursor: pointer;
}
.key { position: relative; overflow: hidden; }
.key.white {
  -webkit-flex: 1; flex: 1;
  margin: 0 1px;
  background: #fff;
  border-radius: 0 0 9px 9px;
  box-shadow: inset 0 -10px 0 var(--key-white-lip), inset 0 7px 5px -5px rgba(0, 0, 0, 0.45);
}
.key.black {
  position: absolute;
  top: 0;
  z-index: 2;
  height: 60%;            /* BLACK_H in app.js */
  width: 6.2%;            /* BLACK_W in app.js */
  margin-left: -3.1%;
  background: var(--key-black);
  border-radius: 0 0 7px 7px;
  box-shadow: inset 0 -9px 0 var(--key-black-lip), inset 0 1px 0 #000, 0 3px 3px rgba(0, 0, 0, 0.4);
}

/* Labels: repeat badge, note letter, key cap. Letters and caps are off by default. */
.caps {
  position: absolute;
  left: 0; right: 0;
  bottom: 18px;
  display: -webkit-flex; display: flex;
  -webkit-flex-direction: column; flex-direction: column;
  -webkit-align-items: center; align-items: center;
  pointer-events: none;
}
.black .caps { bottom: 15px; }
.lbl { font-family: var(--rsm-font-display); font-weight: 700; font-size: 22px; line-height: 1; color: var(--rsm-black); }
.lbl:empty { display: none; }
.black .lbl { color: #fff; font-size: 13px; }
.kbd {
  display: none;
  margin-top: 8px;
  min-width: 34px; height: 34px;
  padding: 0 4px;
  line-height: 28px;
  text-align: center;
  font-family: var(--rsm-font-display);
  font-weight: 700;
  font-size: 19px;
  color: var(--rsm-black);
  background: #fff;
  border: 2px solid var(--rsm-black);
  border-bottom-width: 4px;
  border-radius: 8px;
}
.black .kbd { min-width: 26px; height: 28px; line-height: 23px; font-size: 15px; color: #fff; background: #000; border-color: #9A9A9A; border-radius: 6px; }
.show-kbd .kbd { display: block; }
.lbl:empty + .kbd { margin-top: 0; }
.badge {
  display: none;
  position: relative;
  z-index: 3;             /* readable even where a black key overlaps */
  margin-bottom: 8px;
  width: 44px;
  text-align: center;
  font-family: var(--rsm-font-display);
  font-weight: 700;
  font-size: 15px;
  background: #fff;
  color: var(--rsm-black);
  border-radius: 999px;
  padding: 3px 0;
}
.black .badge { width: 32px; font-size: 12px; margin-bottom: 6px; }
.is-target .badge.on { display: block; }

/* Press ripple (r1/r2) and correct-note pop (p1/p2): transform + opacity only */
.fx {
  position: absolute;
  left: 50%; bottom: 22%;
  width: 70px; height: 70px;
  margin: 0 0 -35px -35px;
  border-radius: 50%;
  background: var(--rsm-cream);
  opacity: 0;
  pointer-events: none;
}
.black .fx { background: #fff; width: 44px; height: 44px; margin: 0 0 -22px -22px; }
.fx.r1 { -webkit-animation: rip1 0.35s ease-out; animation: rip1 0.35s ease-out; }
.fx.r2 { -webkit-animation: rip2 0.35s ease-out; animation: rip2 0.35s ease-out; }
.fx.p1 { background: #fff; -webkit-animation: pop1 0.45s ease-out; animation: pop1 0.45s ease-out; }
.fx.p2 { background: #fff; -webkit-animation: pop2 0.45s ease-out; animation: pop2 0.45s ease-out; }
@-webkit-keyframes rip1 { from { opacity: 0.9; -webkit-transform: scale(0.3); } to { opacity: 0; -webkit-transform: scale(1.6); } }
@keyframes rip1 { from { opacity: 0.9; transform: scale(0.3); } to { opacity: 0; transform: scale(1.6); } }
@-webkit-keyframes rip2 { from { opacity: 0.9; -webkit-transform: scale(0.3); } to { opacity: 0; -webkit-transform: scale(1.6); } }
@keyframes rip2 { from { opacity: 0.9; transform: scale(0.3); } to { opacity: 0; transform: scale(1.6); } }
@-webkit-keyframes pop1 { from { opacity: 1; -webkit-transform: scale(0.4); } to { opacity: 0; -webkit-transform: scale(2.2); } }
@keyframes pop1 { from { opacity: 1; transform: scale(0.4); } to { opacity: 0; transform: scale(2.2); } }
@-webkit-keyframes pop2 { from { opacity: 1; -webkit-transform: scale(0.4); } to { opacity: 0; -webkit-transform: scale(2.2); } }
@keyframes pop2 { from { opacity: 1; transform: scale(0.4); } to { opacity: 0; transform: scale(2.2); } }

/* Pulsing ring on the key to press (shape cue, not only colour) */
.ring {
  position: absolute;
  top: 4px; right: 4px; bottom: 14px; left: 4px;
  border: 5px solid var(--rsm-black);
  border-radius: 2px 2px 7px 7px;
  opacity: 0;
  pointer-events: none;
}
.black .ring { border-color: #fff; border-width: 4px; bottom: 13px; }
.is-target .ring { opacity: 1; -webkit-animation: pulse 1s ease-in-out infinite alternate; animation: pulse 1s ease-in-out infinite alternate; }
@-webkit-keyframes pulse { from { opacity: 1; } to { opacity: 0.3; } }
@keyframes pulse { from { opacity: 1; } to { opacity: 0.3; } }

/* States */
.white.is-down { background: var(--rsm-cream); box-shadow: inset 0 -4px 0 #D6C8AA, inset 0 7px 5px -5px rgba(0, 0, 0, 0.45); }
.black.is-down { background: #4A4A4A; box-shadow: inset 0 -3px 0 #666, inset 0 1px 0 #000; }
.white.is-target, .white.is-lit {
  background: var(--rsm-red);
  box-shadow: inset 0 -10px 0 var(--rsm-red-dark), inset 0 7px 5px -5px rgba(0, 0, 0, 0.45);
}
.black.is-target, .black.is-lit { background: var(--rsm-red); box-shadow: inset 0 -9px 0 var(--rsm-red-dark), 0 3px 3px rgba(0, 0, 0, 0.4); }
.white.is-target.is-down, .white.is-lit.is-down { background: var(--rsm-red-dark); box-shadow: inset 0 -4px 0 #5A0000; }
.is-target .lbl, .is-lit .lbl { color: #fff; }
.is-target .kbd, .is-lit .kbd { background: #fff; color: var(--rsm-black); border-color: #fff; }
.white.is-next1 { background: var(--rsm-blush); }
.white.is-next1 .lbl { color: var(--rsm-red); }
.black.is-next1 { box-shadow: inset 0 0 0 4px var(--rsm-blush), inset 0 -9px 0 var(--key-black-lip); }
.white.is-next2 { background: #FFF7F7; }

.key.shake { -webkit-animation: shake 0.32s ease-in-out; animation: shake 0.32s ease-in-out; }
@-webkit-keyframes shake { 0%, 100% { -webkit-transform: translateX(0); } 25% { -webkit-transform: translateX(-5px); } 75% { -webkit-transform: translateX(5px); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

/* Arrow above the key to press */
.arrow {
  position: absolute;
  top: calc(-1 * (var(--arrow-h) + 14px));
  left: 0;
  width: 0;
  height: var(--arrow-h);
  display: none;
  will-change: transform;
  pointer-events: none;
  z-index: 3;
}
.arrow.on { display: block; }
.arrow-in {
  position: absolute;
  left: -17px; top: 4px;
  width: 0; height: 0;
  border-left: 17px solid transparent;
  border-right: 17px solid transparent;
  border-top: 26px solid var(--rsm-red);
  -webkit-animation: bob 0.8s ease-in-out infinite alternate;
  animation: bob 0.8s ease-in-out infinite alternate;
}
@-webkit-keyframes bob { from { -webkit-transform: translateY(-3px); } to { -webkit-transform: translateY(5px); } }
@keyframes bob { from { transform: translateY(-3px); } to { transform: translateY(5px); } }

/* ---------- Hold bar (songs only): note length + on-time cue ---------- */
.hold {
  display: -webkit-flex; display: flex;
  -webkit-align-items: center; align-items: center;
  height: 34px;
  padding-top: 10px;            /* inside the height, so JS can measure it */
  pointer-events: none;
}
.is-home .hold { display: none; }
.hold-label {
  -webkit-flex-shrink: 0; flex-shrink: 0;
  width: 112px;
  padding-right: 10px;
  font-family: var(--rsm-font-display);
  font-weight: 700;
  font-size: 13px;
  color: var(--rsm-cream);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hold-track {
  position: relative;
  -webkit-flex: 1; flex: 1;
  height: 12px;
  border-radius: 6px;
  background: #2E2E2E;
  overflow: hidden;
}
.hold-zone, .hold-fill, .hold-mark {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  -webkit-transform-origin: 0 50%; transform-origin: 0 50%;
}
.hold-zone { background: var(--rsm-cream); opacity: 0.3; -webkit-transition: opacity 0.12s; transition: opacity 0.12s; }
.hold.in .hold-zone { opacity: 0.85; }                 /* "let go now" */
.hold-fill { background: var(--rsm-red); -webkit-transform: scaleX(0); transform: scaleX(0); }
.hold-mark { border-left: 2px solid #fff; opacity: 0.9; }
.hold-track::after {                                   /* the on-time pulse */
  content: '';
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  border-radius: 6px;
  box-shadow: inset 0 0 0 2px #fff;
  opacity: 0;
}
.hold.good .hold-track::after { -webkit-animation: onTime 0.6s ease-out; animation: onTime 0.6s ease-out; }
@-webkit-keyframes onTime { 30% { opacity: 1; } 100% { opacity: 0; } }
@keyframes onTime { 30% { opacity: 1; } 100% { opacity: 0; } }
.hold.good .hold-label { color: #fff; }
.hold.short .hold-label, .hold.long .hold-label { color: #B8ACA0; }

/* ---------- Options dock ---------- */
.dock {
  display: -webkit-flex; display: flex;
  -webkit-align-items: center; align-items: center;
  -webkit-justify-content: center; justify-content: center;
  -webkit-flex-wrap: wrap; flex-wrap: wrap;
  -webkit-flex-shrink: 0; flex-shrink: 0;
  background: var(--rsm-surface);
  border-top: 1px solid var(--rsm-line);
  border-bottom: 1px solid var(--rsm-line);
  padding: 8px;
}
.main:not(.is-home) .dock { border-bottom: 0; padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
.chip {
  position: relative;
  display: -webkit-inline-flex; display: inline-flex;
  -webkit-align-items: center; align-items: center;
  -webkit-justify-content: center; justify-content: center;
  height: 48px;
  margin: 3px 5px;
  padding: 0 18px 0 14px;
  border: 2px solid var(--rsm-black);
  border-radius: 999px;
  background: var(--rsm-surface);
  color: var(--rsm-black);
  font-family: var(--rsm-font-display);
  font-weight: 700;
  font-size: 15px;
  line-height: 1;
  white-space: nowrap;
}
.chip-ico { display: inline-block; width: 22px; height: 22px; margin-right: 8px; }
.chip-ico svg { width: 22px; height: 22px; display: block; }
.chip-ico-txt { width: 24px; height: 24px; line-height: 20px; text-align: center; border: 2px solid currentColor; border-radius: 50%; font-size: 13px; }
.chip[aria-pressed="true"] { background: var(--rsm-black); color: #fff; }
.chip:active { -webkit-transform: scale(0.97); transform: scale(0.97); }
.chip-play { background: var(--rsm-red); border-color: var(--rsm-red); color: #fff; padding: 0 24px 0 18px; font-size: 17px; min-width: 112px; }
.is-demo .chip-play { background: var(--rsm-black); border-color: var(--rsm-black); }
.chip-oct { padding: 0 2px; cursor: default; }
.chip-oct:active { -webkit-transform: none; transform: none; }
.oct-btn { width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; font-size: 26px; font-weight: 700; line-height: 1; color: var(--rsm-black); }
.oct-btn:active { background: var(--rsm-cream); }
.oct-txt { min-width: 74px; text-align: center; }
.short { display: none; }

.sustain {
  position: absolute;
  right: 12px;
  top: calc(var(--bar-h) + 16px + env(safe-area-inset-top));
  background: var(--rsm-black);
  color: #fff;
  font-family: var(--rsm-font-display);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 4px 10px;
}

/* ---------- Song list (home) ---------- */
.songs-head { max-width: 1100px; margin: 0 auto; padding: 18px 24px 0; }
.songs-title { font-family: var(--rsm-font-display); font-weight: 700; font-size: 26px; color: var(--rsm-black); margin: 0; }
.songs-sub { margin: 2px 0 0; color: var(--rsm-text); }
.cards {
  display: -webkit-flex; display: flex;
  -webkit-flex-wrap: wrap; flex-wrap: wrap;
  max-width: 1100px;
  margin: 0 auto;
  padding: 8px 16px;
}
.card {
  display: -webkit-flex; display: flex;
  -webkit-flex-direction: column; flex-direction: column;
  -webkit-align-items: flex-start; align-items: flex-start;
  text-align: left;
  width: calc(33.333% - 16px);
  margin: 8px;
  min-height: 160px;
  padding: 16px 18px;
  background: var(--rsm-surface);
  border: 2px solid var(--rsm-line);
  border-radius: 18px;
}
.card:active { border-color: var(--rsm-black); }
.card-num {
  font-family: var(--rsm-font-display);
  font-weight: 700;
  font-size: 13px;
  width: 28px; height: 28px; line-height: 24px;
  text-align: center;
  border: 2px solid var(--rsm-black);
  border-radius: 50%;
  color: var(--rsm-black);
  margin-bottom: 10px;
}
.card-title { font-family: var(--rsm-font-display); font-weight: 700; font-size: 21px; line-height: 1.2; color: var(--rsm-black); }
.card-blurb { font-size: 15px; margin-top: 4px; }
.card-foot {
  display: -webkit-flex; display: flex;
  -webkit-align-items: center; align-items: center;
  -webkit-justify-content: space-between; justify-content: space-between;
  width: 100%;
  margin-top: auto;
  padding-top: 14px;
}
.card-meta { font-size: 14px; color: var(--rsm-muted); }
.card-go {
  font-family: var(--rsm-font-display);
  font-weight: 700;
  font-size: 16px;
  background: var(--rsm-red);
  color: #fff;
  border-radius: 999px;
  padding: 9px 22px;
}
.songs-error { text-align: center; color: var(--rsm-black); padding: 0 16px; }
.site-foot {
  display: -webkit-flex; display: flex;
  -webkit-flex-direction: column; flex-direction: column;
  -webkit-align-items: center; align-items: center;
  padding: 18px 0 calc(18px + env(safe-area-inset-bottom));
  font-family: var(--rsm-font-display);
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--rsm-muted);
}
.site-foot img { display: block; width: 140px; height: auto; margin-bottom: 8px; }
@media (max-width: 860px) { .card { width: calc(50% - 16px); } }
@media (max-width: 480px) { .card { width: calc(100% - 16px); min-height: 0; } }

/* ---------- Finish card ---------- */
.overlay {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  background: rgba(250, 250, 250, 0.94);
  display: -webkit-flex; display: flex;
  -webkit-justify-content: center; justify-content: center;
  padding: 12px;
  z-index: 10;
  overflow-y: auto;
}
.sheet {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 720px;
  margin: auto;            /* centres when it fits, scrolls from the top when it doesn't */
  padding: 24px;
  background: var(--rsm-surface);
  border: 2px solid var(--rsm-black);
  border-radius: 22px;
  text-align: center;
  overflow: hidden;
}
.score { font-family: var(--rsm-font-display); font-weight: 700; line-height: 1; margin: 4px 0 12px; }
.score-n { display: inline-block; font-size: 104px; color: var(--rsm-red); min-width: 1.2em; text-align: right; }
.score-of { font-size: 40px; color: var(--rsm-muted); margin-left: 4px; }
.score-n.bump0 { -webkit-animation: bumpA 0.22s ease-out; animation: bumpA 0.22s ease-out; }
.score-n.bump1 { -webkit-animation: bumpB 0.22s ease-out; animation: bumpB 0.22s ease-out; }
@-webkit-keyframes bumpA { from { -webkit-transform: scale(1.25); } to { -webkit-transform: scale(1); } }
@keyframes bumpA { from { transform: scale(1.25); } to { transform: scale(1); } }
@-webkit-keyframes bumpB { from { -webkit-transform: scale(1.25); } to { -webkit-transform: scale(1); } }
@keyframes bumpB { from { transform: scale(1.25); } to { transform: scale(1); } }
.revealed .score-n { -webkit-animation: land 0.5s ease-out; animation: land 0.5s ease-out; }
@-webkit-keyframes land { 40% { -webkit-transform: scale(1.35); } }
@keyframes land { 40% { transform: scale(1.35); } }
.pips { display: -webkit-flex; display: flex; -webkit-justify-content: center; justify-content: center; margin-bottom: 14px; }
.pips span { display: block; width: 26px; height: 10px; margin: 0 3px; border-radius: 5px; background: var(--rsm-line); }
.pips span.on { background: var(--rsm-red); -webkit-animation: pip 0.25s ease-out; animation: pip 0.25s ease-out; }
@-webkit-keyframes pip { from { -webkit-transform: scaleY(2); } to { -webkit-transform: scaleY(1); } }
@keyframes pip { from { transform: scaleY(2); } to { transform: scaleY(1); } }
.fin-best {
  display: inline-block;
  margin: 0 0 8px;
  padding: 3px 12px;
  border-radius: 999px;
  background: var(--rsm-black);
  color: #fff;
  font-family: var(--rsm-font-display);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.fin-title { font-family: var(--rsm-font-display); font-weight: 700; font-size: 28px; line-height: 1.2; color: var(--rsm-black); margin: 0 0 6px; }
.tier-high .fin-title { font-size: 34px; }
.fin-sub { margin: 0 0 18px; font-size: 18px; }
/* Remark, stats and buttons fade in once the count-up lands */
.fin-best, .fin-title, .fin-sub, .stats, .fin-btns {
  opacity: 0;
  -webkit-transform: translateY(10px); transform: translateY(10px);
  -webkit-transition: opacity 0.4s ease-out, -webkit-transform 0.4s ease-out;
  transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}
.revealed .fin-best, .revealed .fin-title, .revealed .fin-sub, .revealed .stats, .revealed .fin-btns { opacity: 1; -webkit-transform: none; transform: none; }
.revealed .fin-sub { -webkit-transition-delay: 0.1s; transition-delay: 0.1s; }
.revealed .stats { -webkit-transition-delay: 0.2s; transition-delay: 0.2s; }
.revealed .fin-btns { -webkit-transition-delay: 0.3s; transition-delay: 0.3s; }
.stats { list-style: none; margin: 0 0 18px; padding: 0; display: -webkit-flex; display: flex; -webkit-flex-wrap: wrap; flex-wrap: wrap; }
.stats li { width: calc(50% - 8px); margin: 4px; background: var(--rsm-bg); border: 1px solid var(--rsm-line); border-radius: 14px; padding: 12px 10px; text-align: left; }
.stat-k { display: block; font-size: 14px; }
.stat-v { display: block; font-family: var(--rsm-font-display); font-weight: 700; font-size: 22px; color: var(--rsm-black); line-height: 1.2; }
.fin-btns { display: -webkit-flex; display: flex; -webkit-flex-wrap: wrap; flex-wrap: wrap; -webkit-justify-content: center; justify-content: center; }
.btn { border: 0; border-radius: 999px; font-family: var(--rsm-font-display); font-weight: 700; font-size: 17px; padding: 13px 26px; min-height: 48px; margin: 5px; }
.btn-red { background: var(--rsm-red); color: #fff; }
.btn-line { background: var(--rsm-surface); color: var(--rsm-black); box-shadow: inset 0 0 0 2px var(--rsm-black); }

.confetti { position: absolute; top: 0; left: 0; right: 0; bottom: 0; overflow: hidden; pointer-events: none; z-index: 1; }
.cf { position: absolute; top: -20px; width: 10px; height: 16px; border-radius: 2px; -webkit-animation: fallA 2.6s linear forwards; animation: fallA 2.6s linear forwards; }
.cf.b { -webkit-animation-name: fallB; animation-name: fallB; }
.cf.c { -webkit-animation-name: fallC; animation-name: fallC; }
@-webkit-keyframes fallA { to { -webkit-transform: translate3d(-60px, 105vh, 0) rotate(540deg); } }
@keyframes fallA { to { transform: translate3d(-60px, 105vh, 0) rotate(540deg); } }
@-webkit-keyframes fallB { to { -webkit-transform: translate3d(70px, 105vh, 0) rotate(-480deg); } }
@keyframes fallB { to { transform: translate3d(70px, 105vh, 0) rotate(-480deg); } }
@-webkit-keyframes fallC { to { -webkit-transform: translate3d(10px, 105vh, 0) rotate(720deg); } }
@keyframes fallC { to { transform: translate3d(10px, 105vh, 0) rotate(720deg); } }

.toast {
  position: fixed;
  left: 50%;
  top: calc(4px + env(safe-area-inset-top));
  z-index: 20;
  -webkit-transform: translateX(-50%); transform: translateX(-50%);
  max-width: 94%;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--rsm-black);
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

/* ---------- Big screen (for screen sharing) ---------- */
.big { --arrow-h: 56px; --bar-h: 60px; }
.big .lbl { font-size: 34px; }
.big .black .lbl { font-size: 20px; }
.big .kbd { min-width: 46px; height: 46px; line-height: 38px; font-size: 26px; border-width: 3px; border-bottom-width: 6px; }
.big .black .kbd { min-width: 34px; height: 36px; line-height: 30px; font-size: 19px; }
.big .ring { border-width: 8px; }
.big .black .ring { border-width: 6px; }
.big .arrow-in { left: -24px; border-left-width: 24px; border-right-width: 24px; border-top-width: 38px; }
.big .progress { height: 12px; }
.big .badge { font-size: 20px; width: 60px; }
.big .hold { height: 46px; padding-top: 14px; }
.big .hold-track { height: 18px; border-radius: 9px; }
.big .hold-label { width: 150px; font-size: 18px; }

/* ---------- Smaller screens ---------- */
@media (max-width: 760px) {
  .long { display: none; }
  .short { display: inline; }
  .chip { padding: 0 14px 0 10px; margin: 3px; font-size: 14px; }
  .chip-play { min-width: 0; padding: 0 18px 0 12px; }
  .oct-txt { min-width: 30px; }
  .case { padding: 12px 6px 8px; border-radius: 12px; }
  .case::before { left: 6px; right: 6px; top: 5px; height: 3px; }
  .arrow { top: calc(-1 * (var(--arrow-h) + 12px)); }
}
@media (max-width: 700px) {
  .bar-bm { display: none; }
  .bar-title { font-size: 15px; }
  .lbl { font-size: 18px; }
  .black .lbl { font-size: 11px; }
  .kbd { min-width: 28px; height: 28px; line-height: 23px; font-size: 16px; margin-top: 6px; }
  .black .kbd { min-width: 22px; height: 24px; line-height: 19px; font-size: 13px; }
  .caps { bottom: 14px; }
  .badge { width: 38px; font-size: 13px; margin-bottom: 5px; }
  .hold-label { width: 92px; font-size: 12px; padding-right: 8px; }
}
@media (max-height: 480px) and (min-width: 520px) {
  .card { width: calc(33.333% - 12px); margin: 6px; min-height: 120px; padding: 12px 14px; }
  .songs-title { font-size: 22px; }
  .card-title { font-size: 18px; }
}
@media (max-height: 420px) {
  :root { --bar-h: 44px; --arrow-h: 30px; }
  .ibtn { height: 40px; }
  .dock { padding-top: 4px; padding-bottom: 4px; }
  .chip { height: 40px; }
  .oct-btn { width: 40px; height: 38px; }
  .hold { height: 26px; padding-top: 8px; }
  .hold-track { height: 10px; }
  .arrow-in { left: -13px; top: 2px; border-left-width: 13px; border-right-width: 13px; border-top-width: 20px; }
  .sheet { padding: 14px; }
  .score { margin-bottom: 6px; }
  .score-n { font-size: 64px; }
  .score-of { font-size: 26px; }
  .pips { margin-bottom: 8px; }
  .fin-title, .tier-high .fin-title { font-size: 24px; }
  .fin-sub { margin-bottom: 8px; font-size: 15px; }
  .stats { margin-bottom: 8px; }
  .stats li { width: calc(25% - 8px); padding: 6px 8px; }
  .stat-k { font-size: 12px; }
  .stat-v { font-size: 16px; }
  .btn { padding: 10px 20px; min-height: 44px; font-size: 15px; }
}
@media (orientation: portrait) and (max-width: 600px) {
  .lbl { font-size: 15px; }
  .kbd { min-width: 24px; height: 26px; line-height: 21px; font-size: 14px; }
  .black .kbd { min-width: 20px; font-size: 11px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .arrow-in, .is-target .ring, .key.shake, .fx, .score-n, .pips span.on, .hold-track::after { -webkit-animation: none !important; animation: none !important; }
  .hold-zone { -webkit-transition: none; transition: none; }
  .progress-fill, .fin-best, .fin-title, .fin-sub, .stats, .fin-btns { -webkit-transition: none; transition: none; }
  .confetti { display: none; }
  .chip:active { -webkit-transform: none; transform: none; }
}
