/* ─────────────────────────────────────────────────────────────────────────
   Major or Minor — styles.

   The staff is drawn by the real compose tool renderer, so the page is built
   around it: paper, brown ink, chroma noteheads. Everything else is the
   arcade's Nunito chrome in the same light key, so the game reads as a game
   without fighting the notation for attention.
   ───────────────────────────────────────────────────────────────────────── */

:root {
  --paper: #f5f5f3;
  --paper-light: #fbfbf9;
  --ink: #1f1d1a;
  --ink-soft: #4a463f;
  --ink-faded: #8a8478;
  --rule: #d8d4cb;
  --brown: #512d1b;

  --major: #66ccff;   /* day-sky blue — bright, like the sun card it carries */
  --major-edge: #3fa9e0;
  --minor: #1b233e;   /* the Prodigies navy — night, like the moon card */
  --minor-edge: #0d1226;
  --green: #6ab845;
  --green-edge: #4e9636;
  --red: #e72829;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-snap: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Nunito', sans-serif;
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }

/* ── Locked levels + the membership wall ───────────────────────────────
   Locked reads as "not yet", never as broken: the card keeps its full colour
   and its name, and only the footer changes from stars to a lock. A greyed-out
   card would say the game is unfinished; this says the level is waiting. */
.mm-level.is-locked { cursor: pointer; }
.mm-level.is-locked .mm-level-name,
.mm-level.is-locked .mm-level-blurb { opacity: .72; }
.mm-lock {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 900; letter-spacing: .04em; text-transform: uppercase;
  color: var(--minor); background: rgba(27, 35, 62, .09);
  padding: 3px 9px; border-radius: 999px;
}
.mm-lock svg { width: 12px; height: 12px; fill: currentColor; display: block; }

.mm-wall {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center; padding: 20px;
  background: rgba(27, 35, 62, .55);
}
.mm-wall-card {
  width: 100%; max-width: 380px; text-align: center;
  background: var(--paper-light); border-radius: 18px; padding: 26px 22px 18px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .28);
}
.mm-wall-lock {
  display: grid; place-items: center; width: 46px; height: 46px; margin: 0 auto 12px;
  border-radius: 50%; background: var(--major); color: var(--minor);
}
.mm-wall-lock svg { width: 22px; height: 22px; fill: currentColor; }
.mm-wall-title { margin: 0 0 4px; font-size: 1.4rem; font-weight: 900; color: var(--ink); }
.mm-wall-blurb { margin: 0 0 12px; color: var(--ink-faded); font-size: .95rem; }
.mm-wall-copy { margin: 0 0 18px; color: var(--ink-soft); font-size: .95rem; line-height: 1.5; }
.mm-wall-cta { display: grid; gap: 10px; }
.mm-wall-btn {
  display: block; padding: 12px 18px; border-radius: 999px;
  background: var(--minor); color: #fff; font-weight: 900; text-decoration: none;
}
.mm-wall-btn:hover { background: var(--minor-edge); }
.mm-wall-alt { color: var(--ink-soft); font-size: .88rem; font-weight: 700; text-decoration: underline; }
.mm-wall-close {
  margin-top: 14px; border: 0; background: none; cursor: pointer;
  color: var(--ink-faded); font-size: .88rem; font-weight: 700;
}
.mm-wall-close:hover { color: var(--ink); }
@media (prefers-reduced-motion: no-preference) {
  .mm-wall-card { animation: mmWallIn .18s cubic-bezier(.22, 1, .36, 1); }
  @keyframes mmWallIn { from { transform: translateY(8px); opacity: 0; } }
}

.mm-app { width: 100%; }
.mm-screen { max-width: 780px; margin: 0 auto; padding: 26px 20px 48px; }
@media (min-width: 901px) { .mm-screen { padding: 34px 24px 56px; } }

.mm-eyebrow {
  margin: 0 0 12px;
  font-size: 10px; font-weight: 900; letter-spacing: 2px;
  text-transform: uppercase; color: var(--ink-faded);
}

.mm-title {
  margin: 0 0 8px;
  font-size: clamp(30px, 8vw, 46px); font-weight: 900;
  letter-spacing: -0.6px; line-height: 1.05;
}
.mm-sub {
  margin: 0 0 26px; max-width: 46ch;
  font-size: 16px; font-weight: 700; color: var(--ink-soft); line-height: 1.5;
}

/* ── Level menu ── */
.mm-levels { display: grid; gap: 12px; }
@media (min-width: 620px) { .mm-levels { grid-template-columns: 1fr 1fr; } }

.mm-level {
  display: grid; gap: 4px; text-align: left;
  background: var(--paper-light);
  border: 2px solid var(--rule); border-bottom-width: 4px; border-radius: 16px;
  padding: 16px 18px 13px;
  transition: transform 0.15s var(--ease-out), border-color 0.15s;
}
.mm-level:hover { transform: translateY(-2px); border-color: var(--major); }
.mm-level-name { font-size: 18px; font-weight: 900; }
.mm-level-blurb { font-size: 13.5px; font-weight: 700; color: var(--ink-soft); }
.mm-level-foot { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.mm-best {
  font-size: 11px; font-weight: 900; color: var(--ink-faded);
  letter-spacing: 1px;
}

.mm-stars i { font-style: normal; color: var(--rule); font-size: 15px; }
.mm-stars i.on { color: #ffc21c; }
.mm-stars.big i { font-size: 30px; }

/* ── Play ── */
.mm-hud {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 14px;
}
.mm-quit {
  background: none; border: none; padding: 4px 0;
  font-size: 11px; font-weight: 900; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--ink-faded);
}
.mm-quit:hover { color: var(--ink); }
.mm-progress {
  font-size: 11px; font-weight: 900; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--ink-faded);
}
.mm-score { font-size: 20px; font-weight: 900; font-variant-numeric: tabular-nums; }
.mm-mult {
  display: inline-block; margin-left: 6px; padding: 2px 8px;
  font-size: 12px; font-style: normal; font-weight: 900;
  color: #fff; background: var(--green); border-radius: 999px;
  animation: pop 0.4s var(--ease-snap);
}

.mm-dots { display: flex; gap: 6px; margin-bottom: 16px; }
.mm-dots i {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--rule); transition: background 0.2s, transform 0.2s;
}
.mm-dots i.hit { background: var(--green); }
.mm-dots i.miss { background: var(--red); }
.mm-dots i.now { background: var(--ink-faded); transform: scale(1.35); }

/* ── The staff, and the card that hides it ── */
.mm-stage { position: relative; margin-bottom: 20px; }
.mm-staff {
  display: grid; place-items: center;
  background: #fff;
  border: 2px solid var(--rule); border-radius: 16px;
  padding: 10px;
  overflow: hidden;
}
/* The Prodigies clef is drawn much taller than the staff it sits on, so the
   score's natural aspect is far too tall for a card holding one chord. Cap the
   height and let it letterbox — a centred staff with air either side reads
   better than a stretched one. */
.mm-staff svg { display: block; width: 100%; height: auto; max-height: 200px; }
@media (min-width: 620px) { .mm-staff svg { max-height: 240px; } }

.mm-cover {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--paper-light);
  border: 2px solid var(--rule); border-radius: 16px;
  transition: opacity 0.45s var(--ease-out), transform 0.45s var(--ease-out);
  /* It is a <button> now, so undo the UA styling and keep the panel look. */
  font: inherit;
  padding: 0;
  width: 100%;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* A press has to acknowledge itself, or a child cannot tell "this does nothing"
   (the bug) from "the chord is playing again". */
.mm-cover:active { transform: scale(0.985); }
.mm-cover span {
  font-size: clamp(44px, 13vw, 76px); font-weight: 900; color: var(--brown);
  animation: bob 1.8s ease-in-out infinite;
}
.mm-cover span:nth-child(2) { animation-delay: 0.15s; }
.mm-cover span:nth-child(3) { animation-delay: 0.3s; }
.mm-cover.is-open { opacity: 0; transform: scale(1.04); pointer-events: none; }

@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes pop { 0% { transform: scale(1); } 45% { transform: scale(1.15); } 100% { transform: scale(1); } }

/* ── Listen ── */
.mm-listen {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; margin-bottom: 16px; padding: 15px 22px;
  font-size: 18px; font-weight: 900; color: #fff;
  background: var(--green); border: none; border-radius: 16px;
  box-shadow: 0 4px 0 var(--green-edge);
  transition: transform 0.14s var(--ease-snap), box-shadow 0.14s;
}
.mm-listen svg { width: 22px; height: 22px; }
.mm-listen:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--green-edge); }
.mm-listen:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--green-edge); }
/* After a correct answer the centre button IS the next-chord action. */
.mm-listen.is-next {
  color: #fff; background: var(--green);
  border: none; box-shadow: 0 4px 0 var(--green-edge);
  font-size: 18px; padding: 15px 22px;
}
.mm-listen.is-next:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--green-edge); }
.mm-listen.is-next:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--green-edge); }

/* Replay retreats to the staff card's corner once the answer is in. */
.mm-replay-corner {
  position: absolute; top: 10px; right: 10px; z-index: 3;
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center;
  color: var(--ink-soft); background: var(--paper-light);
  border: 2px solid var(--rule); border-bottom-width: 3px;
  transition: transform 0.14s var(--ease-snap), border-color 0.14s;
}
/* display:grid outranks the UA's [hidden] rule — restate it. */
.mm-replay-corner[hidden] { display: none; }
.mm-replay-corner svg { width: 20px; height: 20px; }
.mm-replay-corner:hover { transform: translateY(-1px); border-color: var(--ink-faded); color: var(--ink); }
.mm-replay-corner:active { transform: translateY(1px); }

.mm-listen.is-again {
  color: var(--ink-soft); background: var(--paper-light);
  border: 2px solid var(--rule); border-bottom-width: 4px; box-shadow: none;
  font-size: 15px; padding: 11px 18px;
}
.mm-listen.is-again:hover { transform: translateY(-1px); box-shadow: none; border-color: var(--ink-faded); }

/* ── Answers ── */
.mm-answers { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mm-answer {
  display: grid; gap: 2px; padding: 18px 14px;
  color: #fff; border: none; border-radius: 18px;
  transition: transform 0.15s var(--ease-snap), box-shadow 0.15s, opacity 0.2s;
}
.mm-answer-word { font-size: clamp(20px, 5.4vw, 27px); font-weight: 900; letter-spacing: -0.3px; }
.mm-answer-hint { font-size: 12px; font-weight: 800; opacity: 0.85; }

.mm-major { background: var(--major); box-shadow: 0 4px 0 var(--major-edge); color: #1b233e; }
.mm-minor { background: var(--minor); box-shadow: 0 4px 0 var(--minor-edge); }
.mm-answer:hover:not(:disabled) { transform: translateY(-3px); }
.mm-major:hover:not(:disabled) { box-shadow: 0 7px 0 var(--major-edge); }
.mm-minor:hover:not(:disabled) { box-shadow: 0 7px 0 var(--minor-edge); }
.mm-answer:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25); }
.mm-answer:disabled { opacity: 0.42; }

/* After the answer, the right one stays lit and the wrong one steps back. */
.mm-answers.is-done .mm-answer { opacity: 0.3; }
.mm-answers.is-done .mm-answer.is-right {
  opacity: 1; box-shadow: 0 0 0 4px rgba(106, 184, 69, 0.4), 0 4px 0 rgba(0, 0, 0, 0.15);
  animation: pop 0.4s var(--ease-snap);
}
.mm-answers.is-done .mm-answer.is-wrong {
  opacity: 0.85; box-shadow: 0 0 0 4px rgba(231, 40, 41, 0.35), 0 4px 0 rgba(0, 0, 0, 0.15);
  animation: shake 0.4s ease;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); } 60% { transform: translateX(5px); } 80% { transform: translateX(-3px); }
}

.mm-feedback {
  min-height: 26px; margin: 16px 0 0; text-align: center;
  font-size: 16px; font-weight: 800; color: var(--ink-soft);
}
.mm-feedback.is-right { color: #2e7d32; }
.mm-feedback.is-wrong { color: var(--red); }

.mm-next { display: flex; justify-content: center; margin-top: 14px; min-height: 52px; }

.mm-btn {
  padding: 13px 26px; font-size: 16px; font-weight: 900;
  color: #fff; background: var(--green); border: none; border-radius: 14px;
  box-shadow: 0 4px 0 var(--green-edge);
  transition: transform 0.14s var(--ease-snap), box-shadow 0.14s;
}
.mm-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--green-edge); }
.mm-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--green-edge); }
.mm-btn.ghost {
  color: var(--ink-soft); background: var(--paper-light);
  border: 2px solid var(--rule); border-bottom-width: 4px; box-shadow: none;
}
.mm-btn.ghost:hover { border-color: var(--ink-faded); box-shadow: none; }

/* ── Results ── */
.mm-results { text-align: center; }
.mm-result-head { margin: 0 0 20px; font-size: clamp(26px, 7vw, 38px); font-weight: 900; }
.mm-scorecard {
  background: var(--paper-light);
  border: 2px solid var(--rule); border-radius: 20px;
  padding: 24px 20px 20px; margin-bottom: 20px;
}
.mm-big { margin: 0; font-size: 58px; font-weight: 900; line-height: 1; }
.mm-big span { font-size: 24px; color: var(--ink-faded); margin-left: 6px; }
.mm-scorecard .mm-stars { display: block; margin: 10px 0 8px; }
.mm-points { margin: 0; font-size: 15px; font-weight: 800; color: var(--ink-soft); }
.mm-pb { color: var(--green-edge); }
.mm-streak-note { margin: 6px 0 0; font-size: 13px; font-weight: 700; color: var(--ink-faded); }

.mm-missed { text-align: left; margin-bottom: 20px; }
.mm-missed-title {
  margin: 0 0 10px; font-size: 9px; font-weight: 900; letter-spacing: 2px;
  text-transform: uppercase; color: var(--ink-faded);
}
.mm-missed ul { margin: 0; padding: 0; list-style: none; }
.mm-missed li {
  padding: 10px 0; border-top: 1px solid var(--rule);
  font-size: 14.5px; font-weight: 700; color: var(--ink-soft);
}
.mm-missed li b { font-size: 17px; font-weight: 900; color: var(--ink); margin-right: 6px; }
.mm-missed li span { display: block; font-size: 12.5px; color: var(--ink-faded); margin-top: 2px; }

.mm-result-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
#classScoreSlot { max-width: 560px; margin: 0 auto 18px; text-align: left; }

@media (prefers-reduced-motion: reduce) {
  .mm-cover span, .mm-mult, .mm-answer { animation: none; }
  * { transition-duration: 0.01ms !important; }
}
