:root {
  --pink: #f55f92;
  --deep-pink: #d9477a;
  --purple: #7160be;
  --ink: #4a4676;
  --mint: #bdebdc;
  --yellow: #ffd965;
  --cream: #fffaf2;
}

* { box-sizing: border-box; }

html { min-width: 0; }

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 15%, rgba(255,255,255,.85) 0 3px, transparent 4px),
    radial-gradient(circle at 92% 28%, rgba(255,255,255,.7) 0 5px, transparent 6px),
    linear-gradient(145deg, #dff8ef, #e5ddff 48%, #ffdce8);
  background-size: 42px 42px, 66px 66px, auto;
  font-family: "Arial Rounded MT Bold", "Trebuchet MS", Arial, sans-serif;
}

button, a { font: inherit; }
button { touch-action: manipulation; }

.game-header {
  width: min(1120px, calc(100% - 28px));
  min-height: 74px;
  margin: 14px auto 0;
  padding: 10px 14px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  border: 1px solid rgba(255,255,255,.86);
  border-radius: 22px;
  background: rgba(255,255,255,.72);
  box-shadow: inset 0 1px #fff, 0 14px 34px rgba(72,55,135,.12);
  backdrop-filter: blur(14px);
}

.game-header img { width: 108px; height: 54px; object-fit: contain; }

.back-link,
.sound-toggle {
  justify-self: start;
  border: 1px solid rgba(106,86,181,.15);
  border-radius: 13px;
  background: #fff;
  box-shadow: 0 5px 12px rgba(76,56,140,.1);
  color: var(--purple);
  text-decoration: none;
  font-size: 13px;
  font-weight: 900;
}

.back-link { padding: 10px 13px; }
.sound-toggle { width: 42px; height: 42px; padding: 0; justify-self: end; cursor: pointer; }
.sound-toggle:disabled { opacity: .62; cursor: not-allowed; }
.back-link:focus-visible,
.sound-toggle:focus-visible,
.game-actions button:focus-visible,
.compatibility-actions a:focus-visible {
  outline: 3px solid #40356f;
  outline-offset: 3px;
}

.game-shell {
  width: min(1120px, calc(100% - 28px));
  margin: 24px auto 30px;
}

.intro { text-align: center; }
.eyebrow { margin: 0 0 8px; color: var(--deep-pink); font-size: 12px; font-weight: 900; letter-spacing: 1.8px; }
.intro h1 { margin: 0; color: #51478d; font-size: clamp(34px, 6vw, 62px); line-height: .98; letter-spacing: -2.3px; text-wrap: balance; }
.intro > p:last-child { margin: 13px auto 24px; color: #6f6985; font-family: Arial, sans-serif; font-size: 17px; }

.play-stage {
  display: grid;
  grid-template-columns: minmax(270px, 360px) minmax(500px, 1fr);
  gap: 24px;
  align-items: stretch;
}

.brenda-card,
.music-area {
  border: 1px solid rgba(255,255,255,.9);
  border-radius: 29px;
  background: rgba(255,255,255,.78);
  box-shadow: inset 0 1px #fff, 0 23px 48px rgba(69,52,127,.15);
}

.brenda-card {
  position: relative;
  min-height: 515px;
  overflow: hidden;
}

.brenda-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 0 8px rgba(255,255,255,.28);
  border-radius: inherit;
}

.brenda-card picture { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.brenda-card img { width: 100%; height: 100%; display: block; object-fit: cover; }

.brenda-card.is-dancing img { animation: brendaDance .42s ease-in-out; }

@keyframes brendaDance {
  0%, 100% { transform: rotate(0) scale(1); }
  30% { transform: rotate(-1.5deg) scale(1.025); }
  70% { transform: rotate(1.5deg) scale(1.025); }
}

.brenda-speech {
  position: absolute;
  z-index: 2;
  left: 18px;
  right: 18px;
  bottom: 18px;
  padding: 14px 17px;
  border: 2px solid rgba(255,255,255,.9);
  border-radius: 18px 18px 5px 18px;
  background: rgba(255,255,255,.94);
  box-shadow: 0 10px 24px rgba(67,48,120,.2);
  color: var(--deep-pink);
  text-align: center;
  font-weight: 900;
}

.music-area { padding: 25px; }

.progress-card {
  padding: 13px 15px;
  border-radius: 17px;
  background: #f8f5ff;
  box-shadow: inset 0 1px #fff;
}

.progress-copy { margin-bottom: 8px; display: flex; align-items: center; justify-content: space-between; font-size: 13px; }
.progress-copy strong { color: var(--deep-pink); }
.progress-track { height: 15px; overflow: hidden; border: 2px solid #fff; border-radius: 999px; background: #e7e1f5; box-shadow: inset 0 2px 4px rgba(66,49,123,.12); }
.progress-track i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #76d5b8, #ffd65e 52%, #f56b9a); transition: width .3s ease; }

.accordion {
  --bellows-scale: 1;
  min-height: 280px;
  margin: 22px 0 18px;
  display: grid;
  grid-template-columns: 112px minmax(135px, 1fr) 160px;
  align-items: stretch;
  filter: drop-shadow(0 16px 13px rgba(65,43,118,.2));
  transform-origin: center;
}

.accordion.is-playing { animation: accordionBounce .25s ease; }

@keyframes accordionBounce {
  50% { transform: scale(.985) rotate(-.3deg); }
}

.accordion-side {
  position: relative;
  z-index: 1;
  border: 5px solid #f7bccc;
  background: linear-gradient(145deg, #ff83aa, #de477e);
  box-shadow: inset 5px 0 rgba(255,255,255,.28), inset -5px 0 rgba(128,31,76,.14);
}

.bass-side { border-radius: 32px 8px 8px 32px; display: grid; grid-template-columns: repeat(2, 18px); place-content: center; gap: 14px; }
.bass-side span { width: 18px; height: 18px; border: 3px solid #f7d7e1; border-radius: 50%; background: #6d4d9e; box-shadow: inset 0 2px rgba(255,255,255,.4), 0 3px rgba(103,30,70,.18); }

.bellows {
  min-width: 0;
  display: flex;
  align-items: stretch;
  justify-content: space-evenly;
  overflow: hidden;
  border-block: 5px solid #d992ab;
  background: repeating-linear-gradient(90deg, #4f467e 0 8px, #8b7bb1 8px 15px, #e4cae5 15px 20px, #66578f 20px 28px);
  transform: scaleX(var(--bellows-scale));
  transition: transform .18s ease;
}

.bellows i { width: 2px; background: rgba(255,255,255,.38); box-shadow: 4px 0 rgba(45,34,86,.3); }

.keyboard-side { border-radius: 8px 32px 32px 8px; padding: 17px 16px; }
.note-buttons { height: 100%; display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; }
.note-buttons button {
  min-width: 0;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 2px solid rgba(255,255,255,.86);
  border-radius: 10px;
  background: #fff;
  box-shadow: inset 0 -3px #e9def1, 0 4px 7px rgba(99,37,82,.16);
  color: #64518f;
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
  transition: transform .1s ease, background .1s ease;
}

.note-buttons button:nth-child(4n + 1) { --note-color: #ff8eb2; }
.note-buttons button:nth-child(4n + 2) { --note-color: #ffd460; }
.note-buttons button:nth-child(4n + 3) { --note-color: #7bd8bc; }
.note-buttons button:nth-child(4n + 4) { --note-color: #a995e8; }
.note-buttons button:hover,
.note-buttons button.is-active { background: var(--note-color); color: #33294e; transform: translateY(2px); box-shadow: inset 0 -2px rgba(78,45,116,.12); }
.note-buttons button:focus-visible { background: var(--note-color); color: #33294e; outline: 3px solid #33294e; outline-offset: 2px; }
.note-buttons kbd { padding: 2px 5px; border-radius: 5px; background: rgba(108,83,156,.1); color: inherit; font: 9px Arial, sans-serif; }

.game-actions { display: flex; justify-content: center; gap: 10px; }
.game-actions button {
  padding: 12px 16px;
  border: 1px solid rgba(255,255,255,.8);
  border-radius: 13px;
  box-shadow: inset 0 1px rgba(255,255,255,.5), 0 7px 13px rgba(76,56,140,.14);
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
}
.melody-button { background: linear-gradient(145deg, #7059c2, #56439e); color: #fff; }
.reset-button { background: #fff; color: var(--purple); }
.game-actions button:disabled { opacity: .55; cursor: wait; }
.keyboard-tip { margin: 14px 0 0; color: #898399; text-align: center; font: 12px Arial, sans-serif; }
.audio-credit { margin: 7px 0 0; color: #9089a0; text-align: center; font: 10px/1.4 Arial, sans-serif; }

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.confetti-layer { position: fixed; z-index: 20; inset: 0; overflow: hidden; pointer-events: none; }
.confetti-piece { position: absolute; top: -24px; width: 11px; height: 18px; border-radius: 3px; animation: confettiFall 2.4s linear forwards; }
@keyframes confettiFall { to { transform: translate3d(var(--drift), 110vh, 0) rotate(720deg); } }

footer { padding: 0 15px 25px; color: #827b98; text-align: center; font: 12px Arial, sans-serif; }

.compatibility-page {
  min-height: 100vh;
  padding: 24px;
  display: grid;
  place-items: center;
}

.compatibility-card {
  width: min(620px, 100%);
  padding: clamp(28px, 7vw, 54px);
  border: 1px solid rgba(255,255,255,.9);
  border-radius: 30px;
  background: rgba(255,255,255,.86);
  box-shadow: inset 0 1px #fff, 0 23px 48px rgba(69,52,127,.16);
  text-align: center;
}

.compatibility-card > img { width: 128px; height: 72px; object-fit: contain; }
.compatibility-icon { width: 86px; height: 86px; margin: 15px auto 18px; display: grid; place-items: center; border: 1px solid #fff; border-radius: 25px; background: linear-gradient(145deg, #d8f7ec, #d8ceff); box-shadow: inset 0 1px #fff, 0 11px 22px rgba(72,55,135,.13); font-size: 43px; }
.compatibility-card h1 { margin: 0; color: #51478d; font-size: clamp(28px, 6vw, 43px); line-height: 1.04; letter-spacing: -1.4px; text-wrap: balance; }
.compatibility-card > p:not(.eyebrow) { max-width: 480px; margin: 16px auto 22px; color: #746e88; font: 16px/1.55 Arial, sans-serif; }
.compatibility-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; }
.compatibility-actions a { padding: 12px 16px; border: 1px solid rgba(111,91,182,.2); border-radius: 13px; background: #fff; box-shadow: 0 6px 13px rgba(76,56,140,.1); color: var(--purple); text-decoration: none; font-size: 13px; font-weight: 900; }
.compatibility-actions a.primary { border-color: rgba(255,255,255,.75); background: linear-gradient(145deg, #8271d0, #6250ad); color: #fff; }
.compatibility-card small { display: block; margin-top: 20px; color: #948da1; font: 11px/1.45 Arial, sans-serif; }

@media (max-width: 850px) {
  .play-stage { grid-template-columns: 1fr; }
  .brenda-card { min-height: 390px; }
  .brenda-card img { object-position: center 42%; }
}

@media (max-width: 580px) {
  .game-header { min-height: 62px; border-radius: 17px; }
  .game-header img { width: 78px; height: 43px; }
  .back-link { padding: 9px; font-size: 11px; }
  .sound-toggle { width: 38px; height: 38px; }
  .game-shell { margin-top: 18px; }
  .intro h1 { font-size: clamp(34px, 12vw, 48px); }
  .play-stage { gap: 16px; }
  .brenda-card { min-height: 320px; border-radius: 22px; }
  .music-area { padding: 17px 12px; border-radius: 22px; }
  .accordion { min-height: 235px; grid-template-columns: 68px minmax(48px, 1fr) 122px; }
  .accordion-side { border-width: 4px; }
  .bass-side { grid-template-columns: repeat(2, 14px); gap: 10px; }
  .bass-side span { width: 14px; height: 14px; border-width: 2px; }
  .keyboard-side { padding: 12px 9px; }
  .note-buttons { gap: 5px; }
  .note-buttons button { padding: 3px; font-size: 10px; }
  .game-actions { flex-direction: column; }
  .game-actions button { width: 100%; }
}

@media (max-width: 340px) {
  .game-header,
  .game-shell { width: calc(100% - 18px); }
  .music-area { padding-inline: 8px; }
  .accordion { grid-template-columns: 58px minmax(38px, 1fr) 116px; }
  .keyboard-side { padding-inline: 7px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
