/* =====================================================
   JINGLE KEYS — kids' piano
   ===================================================== */

.jk-hero {
  background: linear-gradient(180deg, #fbe9e7 0%, var(--parchment) 100%);
  padding: 0.9rem 1rem 0.3rem;
  text-align: center;
}
.jk-hero .section-title { font-size: clamp(1.6rem, 6vw, 2.2rem); }
.jk-hero .section-subtitle { font-size: 0.9rem; margin-bottom: 0.4rem; }
.jk-hero .section-title { margin-bottom: 0.2rem; }
.jk-hero .crumbs { text-align: left; max-width: 900px; margin: 0 auto 0.25rem; font-weight: 800; font-size: 0.9rem; }
.jk-hero .crumbs a { color: var(--green); }
.jk-hero .crumbs a:hover { text-decoration: underline; }

.jk-app { max-width: 980px; margin: 0 auto; padding: 0.5rem 0.75rem 2rem; position: relative; }

/* ---------- control panel ---------- */
.jk-panel {
  background: #fff;
  border: 3px solid var(--parchment3);
  border-radius: 18px;
  padding: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  box-shadow: var(--shadow-card);
}

.jk-songs { display: flex; flex-wrap: nowrap; gap: 0.4rem; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 2px; scrollbar-width: none; }
.jk-songs::-webkit-scrollbar { display: none; }
@media (min-width: 700px) { .jk-songs { flex-wrap: wrap; justify-content: center; overflow: visible; } }
.jk-song {
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--brown);
  background: var(--parchment2);
  border: 2px solid var(--parchment3);
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  cursor: pointer;
  min-height: 44px;
  flex: 0 0 auto;
  white-space: nowrap;
  line-height: 1.1;
}
.jk-song small { display: block; font-family: var(--font-body); font-weight: 800; font-size: 0.7rem; opacity: 0.7; }
.jk-song[aria-pressed="true"] { background: var(--red); border-color: var(--red); color: #fff; }

.jk-modes { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; }
.jk-mode {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: #fff;
  background: var(--green);
  border: 0;
  border-radius: 14px;
  padding: 0.4rem 0.9rem;
  min-height: 46px;
  cursor: pointer;
  box-shadow: 0 3px 0 rgba(0,0,0,0.18);
  flex: 1 1 100px;
  max-width: 190px;
}
.jk-mode span { margin-right: 0.15rem; }
.jk-mode:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0,0,0,0.18); }
.jk-mode[aria-pressed="true"] { background: var(--gold); color: var(--brown); }
.jk-stop { background: var(--red); }

.jk-speed { display: flex; align-items: center; justify-content: center; gap: 0.4rem; flex-wrap: wrap; }
.jk-speed-label { font-weight: 800; font-size: 0.85rem; color: var(--brown); }
.jk-sp {
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--brown);
  background: var(--parchment2);
  border: 2px solid var(--parchment3);
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  min-height: 38px;
  cursor: pointer;
}
.jk-sp[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); }

.jk-status {
  text-align: center;
  font-weight: 700;
  color: var(--brown);
  min-height: 2.6em;
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.3;
}
.jk-progress { height: 8px; background: var(--parchment3); border-radius: 99px; overflow: hidden; }
.jk-progress > div { height: 100%; width: 0; background: linear-gradient(90deg, var(--green), var(--gold)); transition: width 0.15s linear; }

/* ---------- keyboard + lane ---------- */
.jk-speed-below { margin-top: 0.7rem; }
.jk-board {
  margin-top: 0.6rem;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  border-radius: 16px;
  background: #2b1d14;
  padding: 0;
  border: 3px solid #2b1d14;
  box-shadow: var(--shadow-card);
}
.jk-inner { position: relative; margin: 0 auto; }
#lane {
  display: block;
  width: 100%;
  background: linear-gradient(180deg, #1b2a4a 0%, #2d4a7a 100%);
  touch-action: pan-x;
}
.jk-keys { position: relative; height: 170px; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; background: #2b1d14; }

.jk-key {
  position: absolute;
  top: 0;
  box-sizing: border-box;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.jk-key.white {
  height: 100%;
  background: linear-gradient(180deg, #fffdf6 0%, #f3ecda 100%);
  border: 1px solid #b9a98a;
  border-radius: 0 0 10px 10px;
  display: flex; align-items: flex-end; justify-content: center;
  padding-bottom: 10px;
  z-index: 1;
}
.jk-key.black {
  height: 62%;
  background: linear-gradient(180deg, #4a3526 0%, #1a110b 100%);
  border-radius: 0 0 7px 7px;
  z-index: 3;
  box-shadow: 0 3px 4px rgba(0,0,0,0.5);
}
.jk-key .kl {
  width: 1.9rem; height: 1.9rem; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 1rem;
  color: #fff;
  background: var(--nc, #999);
  text-shadow: 0 1px 1px rgba(0,0,0,0.35);
  pointer-events: none;
}
.jk-key.black .kl { display: none; }
.jk-key.down { transform: translateY(2px); filter: brightness(0.92); }
.jk-key.white.lit, .jk-key.white.down { background: linear-gradient(180deg, var(--nc, #ffe08a) 0%, #fff6d8 100%); }
.jk-key.black.lit, .jk-key.black.down { background: linear-gradient(180deg, var(--nc, #ffb703) 0%, #5a3a10 100%); }

.jk-key.target { animation: jk-pulse 0.9s ease-in-out infinite; }
.jk-key.white.target { background: linear-gradient(180deg, var(--nc) 0%, #fff6d8 85%); box-shadow: inset 0 0 0 4px var(--nc); }
.jk-key.black.target { background: linear-gradient(180deg, var(--nc) 0%, #3a2410 100%); box-shadow: 0 0 14px var(--nc); }
@keyframes jk-pulse { 0%,100% { filter: brightness(1); } 50% { filter: brightness(1.18); } }

.jk-key.oops { animation: jk-shake 0.25s; }
@keyframes jk-shake { 0%,100% { transform: translateX(0);} 25% { transform: translateX(-3px);} 75% { transform: translateX(3px);} }

.jk-count {
  position: absolute; left: 0; right: 0; top: 0; height: 170px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 5rem; color: #fff; text-shadow: 0 4px 0 rgba(0,0,0,0.35);
  pointer-events: none;
}

.jk-hint { text-align: center; font-size: 0.85rem; color: var(--brown); opacity: 0.85; margin: 0.7rem 0 0; }
.jk-hint-kb { display: none; }
@media (hover: hover) and (pointer: fine) {
  .jk-hint-kb { display: inline; }
  .jk-hint-touch { display: none; }
}

/* ---------- result popup ---------- */
.jk-result {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(30, 20, 10, 0.55);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.jk-result[hidden] { display: none; }
.jk-result-card {
  background: var(--parchment);
  border: 4px solid var(--gold);
  border-radius: 22px;
  padding: 1.4rem 1.2rem;
  max-width: 360px; width: 100%;
  text-align: center;
  animation: jk-pop 0.35s ease-out;
}
@keyframes jk-pop { from { transform: scale(0.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.jk-stars { font-size: 2.4rem; letter-spacing: 0.2rem; }
.jk-result-card h2 { font-family: var(--font-display); color: var(--red); margin: 0.3rem 0; }
.jk-result-card p { margin: 0 0 1rem; color: var(--brown); font-weight: 700; }
.jk-result-btns { display: flex; gap: 0.6rem; justify-content: center; flex-wrap: wrap; }

@media (min-width: 700px) {
  .jk-keys, .jk-count { height: 230px; }
  .jk-panel { padding: 0.8rem; gap: 0.65rem; }
}
@media (prefers-reduced-motion: reduce) {
  .jk-key.target { animation: none; }
  .jk-result-card { animation: none; }
}
