/* Original project Copyright (c) 2017 MIT 6.813/6.831 course staff.
 * Redistribution of original or derived work requires permission of course staff. */
:root {
  /* Functional labels use at least 12px; supporting copy uses 13-14px. */
  --cream: #fbf5ed;
  --ink: #49374d;
  --muted: #705d73;
  --pink: #e9588e;
  --pink-dark: #c93b74;
  --line: #e9dfe0;
  --font: "Nunito Sans", sans-serif;
  --display: "Fredoka", sans-serif;
  --icon-bg: #fff9f3;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font);
  font-weight: 600;
  -webkit-font-smoothing: antialiased;
}
button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  border: 0;
  transition:
    transform 0.2s,
    background 0.2s,
    box-shadow 0.2s;
  -webkit-tap-highlight-color: transparent;
}
button:disabled {
  cursor: not-allowed;
  opacity: 1;
  color: #705d73;
}
button:focus-visible,
a:focus-visible {
  outline: 3px solid #8c62b1;
  outline-offset: 5px;
}
button:active:not(:disabled) {
  transform: translateY(2px);
}
svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
button svg {
  pointer-events: none;
}
[hidden] {
  display: none !important;
}
.icon-library {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}
.landscape {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(#fbf5edc9, #fbf5ed55),
    url("assets/candy-valley.webp") center bottom/cover no-repeat;
  opacity: 0.6;
}
.app-shell {
  max-width: 1320px;
  margin: auto;
  padding: 0 56px;
}
.site-header {
  height: 118px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #dbcbd650;
  gap: 28px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  text-align: left;
  background: none;
  line-height: 0.85;
  font-family: var(--display);
  font-size: 31px;
  font-weight: 600;
  letter-spacing: -1.2px;
}
.brand-rush {
  color: var(--pink);
}
.brand small {
  font-family: var(--font);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.8px;
  display: block;
  margin-top: 11px;
  color: var(--muted);
}
.brand-mark {
  position: relative;
  display: block;
  width: 42px;
  height: 49px;
  transform: rotate(-25deg);
}
.brand-mark:before,
.brand-mark:after {
  content: "";
  position: absolute;
  width: 15px;
  height: 17px;
  background: #ef97b8;
  left: 14px;
  border-radius: 3px;
  clip-path: polygon(0 0, 100% 0, 80% 100%, 20% 100%);
}
.brand-mark:before {
  top: 0;
  transform: rotate(180deg);
}
.brand-mark:after {
  bottom: 0;
}
.brand-mark span {
  position: absolute;
  inset: 11px 3px;
  border: 3px solid #fff0f4;
  border-radius: 11px;
  background: repeating-linear-gradient(90deg, #ef759f 0 7px, #ffc1d5 7px 13px);
  box-shadow: 0 3px 0 #ce5c8b;
}
.header-nav {
  display: flex;
  gap: 35px;
  margin-left: 34px;
}
.nav-link {
  position: relative;
  background: none;
  font-size: 14px;
  font-weight: 800;
  padding: 14px 0;
  color: var(--muted);
}
.nav-link.active {
  color: var(--pink-dark);
}
.nav-link.active:after {
  content: "";
  position: absolute;
  bottom: 4px;
  left: 40%;
  right: 40%;
  height: 3px;
  border-radius: 4px;
  background: var(--pink);
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sound-status {
  font-size: 13px;
  color: var(--muted);
  margin-right: 5px;
}
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: #fff9f3bb;
  width: 41px;
  height: 41px;
  border: 1px solid #e6dbe0;
  border-radius: 50%;
  color: #7c647e;
}
.icon-button:hover {
  background: #f6e5ec;
  box-shadow: 0 3px 9px #6244590a;
}
.icon-button svg {
  width: 19px;
  height: 19px;
}
.off-dot {
  position: absolute;
  width: 7px;
  height: 7px;
  background: #b3a3b3;
  bottom: 7px;
  right: 7px;
  border: 2px solid var(--cream);
  border-radius: 50%;
}
.icon-button[aria-pressed="true"] {
  color: var(--pink-dark);
  background: #fce0eb;
}
.icon-button[aria-pressed="true"] .off-dot {
  background: #77a388;
}
.hero {
  min-height: 530px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  align-items: center;
  padding: 42px 0 40px;
}
.eyebrow {
  font-size: 12px;
  letter-spacing: 0.8px;
  font-weight: 900;
  color: #826278;
}
.hero-copy .eyebrow {
  display: flex;
  gap: 9px;
  align-items: center;
}
.eyebrow > span:empty {
  width: 6px;
  height: 6px;
  background: #e992ae;
  border-radius: 50%;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1,
h2,
h3 {
  font-family: var(--display);
  font-weight: 500;
}
h1 {
  font-size: 76px;
  line-height: 1.04;
  letter-spacing: -2.3px;
  position: relative;
  margin: 21px 0 20px;
  max-width: 430px;
}
h1 > span {
  color: var(--pink);
}
.title-spark {
  position: absolute;
  top: 3px;
  right: -6px;
  width: 39px;
  height: 49px;
  color: #dca154;
  stroke-width: 3.5;
  transform: rotate(9deg);
}
.hero-copy > p {
  font-size: 14px;
  line-height: 1.9;
  color: #8a7486;
}
.primary-button {
  background: linear-gradient(#c5477b, #ae3267);
  border: 1px solid #a83265;
  border-radius: 17px;
  box-shadow:
    0 5px 0 #bd3d70,
    0 9px 19px #d7558524,
    inset 0 2px 0 #ffffff50;
  color: white;
  padding: 17px 29px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 17px;
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 0.1px;
}
.primary-button:hover {
  background: linear-gradient(#b83f73, #9e285c);
  transform: translateY(-2px);
  box-shadow:
    0 7px 0 #bd3d70,
    0 13px 23px #d7558530;
}
.primary-button:disabled {
  background: #ede6eb;
  border-color: #d8c9d4;
  box-shadow: none;
  color: #705d73;
}
.play-button {
  margin-top: 27px;
  min-width: 232px;
}
.play-button svg:first-child {
  width: 18px;
}
.play-button svg:last-child {
  margin-left: 18px;
}
.hero-note {
  font-size: 12px;
  color: #705a70;
  margin-top: 20px;
  display: flex;
  gap: 7px;
  align-items: center;
}
.hero-note svg {
  width: 12px;
  height: 12px;
  fill: #dcc28d;
  color: #c9a565;
}
.personal-best {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-top: 30px;
}
.personal-best > svg {
  color: #c7a15d;
  width: 30px;
  height: 30px;
  fill: #f6e6bc;
  stroke-width: 1.2;
}
.personal-best span {
  display: block;
  font-size: 12px;
  letter-spacing: 0.8px;
  color: #796676;
}
.personal-best strong {
  display: block;
  font-size: 13px;
  font-weight: 800;
  margin-top: 4px;
  color: #816b7d;
}
.hero-art {
  position: relative;
  height: 445px;
  display: flex;
  align-items: center;
  justify-content: center;
  isolation: isolate;
}
.art-orbit {
  position: absolute;
  width: 392px;
  height: 392px;
  background: #eddee573;
  border: 1px solid #ead6e650;
  border-radius: 50%;
  z-index: -1;
}
.art-orbit:after {
  content: "";
  position: absolute;
  inset: -24px;
  border: 1px dashed #ddc9d6;
  border-radius: 50%;
  opacity: 0.6;
}
.preview-board-wrap {
  width: 332px;
  padding: 21px 16px 16px;
  border: 6px solid #fff6f4;
  border-radius: 29px;
  background: #d8bdd6;
  box-shadow:
    0 10px 0 #b797b6,
    0 25px 45px #8e62722b,
    inset 0 0 0 2px #c7a4c5;
  transform: rotate(9deg);
  position: relative;
}
.preview-board {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 3px;
  padding: 8px;
  background: #bda5c5;
  border-radius: 15px;
  border: 2px solid #b191bd;
  box-shadow: inset 0 3px 9px #68477726;
}
.preview-cell {
  background: #f1e5f3a8;
  border-radius: 7px;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 1px 1px #fff7;
}
.preview-cell:nth-child(12n + 2),
.preview-cell:nth-child(12n + 4),
.preview-cell:nth-child(12n + 6),
.preview-cell:nth-child(12n + 7),
.preview-cell:nth-child(12n + 9),
.preview-cell:nth-child(12n + 11) {
  background: #e2d0e9;
}
.preview-cell img {
  width: 89%;
  height: 89%;
  object-fit: contain;
  filter: drop-shadow(0 3px 1px #64415e22);
}
.preview-cell.matched {
  background: #fff5cf;
  box-shadow:
    inset 0 0 0 2px #f2d98e,
    0 0 15px #ffe9b9;
}
.preview-ribbon {
  position: absolute;
  top: -21px;
  left: 12%;
  right: 5%;
  display: flex;
  gap: 7px;
  align-items: center;
  justify-content: center;
  background: #fffaf0;
  border: 1px solid #efdfca;
  border-radius: 9px;
  padding: 10px 6px;
  color: #816553;
  font-size: 12px;
  box-shadow: 0 3px 0 #ded1c3;
  transform: rotate(-9deg);
}
.preview-ribbon svg {
  width: 15px;
  height: 15px;
  fill: #e4bd6d;
  color: #d5a955;
}
.floating-candy {
  position: absolute;
  z-index: 2;
  animation: float 6s ease-in-out infinite;
}
.floating-candy img {
  height: 100%;
  width: 100%;
  object-fit: contain;
  filter: drop-shadow(0 10px 6px #a7647a26);
}
.candy-one {
  width: 88px;
  height: 88px;
  left: 10px;
  top: 43px;
  transform: rotate(-22deg);
}
.candy-two {
  width: 85px;
  height: 85px;
  right: 1px;
  top: 52px;
  animation-delay: -2s;
  transform: rotate(20deg);
}
.candy-three {
  width: 80px;
  height: 80px;
  left: 20px;
  bottom: 26px;
  animation-delay: -4s;
  transform: rotate(-17deg);
}
.art-spark {
  position: absolute;
  color: #cda663;
  stroke-width: 1;
  width: 46px;
  height: 46px;
}
.spark-one {
  top: 3px;
  left: 125px;
}
.spark-two {
  right: 12px;
  bottom: 105px;
  width: 34px;
  height: 34px;
}
.match-bubble {
  position: absolute;
  bottom: 17px;
  right: 5px;
  background: #fffaf2;
  padding: 16px 23px 18px;
  border-radius: 18px;
  transform: rotate(-6deg);
  border: 1px solid #eddfd4;
  box-shadow:
    0 6px 0 #e9dcd1,
    0 13px 26px #87576712;
  text-align: center;
}
.match-bubble strong {
  font-family: var(--display);
  font-size: 30px;
  font-weight: 500;
  color: var(--pink);
  display: block;
  line-height: 1.2;
}
.match-bubble > span:last-child {
  font-size: 12px;
  color: #7c6578;
}
.bubble-stars {
  color: #d7af62;
  display: flex;
  justify-content: center;
  gap: 5px;
}
.bubble-stars svg {
  width: 13px;
  height: 13px;
  fill: #e5c680;
  stroke-width: 1;
}
.art-caption {
  position: absolute;
  bottom: -22px;
  font-size: 12px;
  letter-spacing: 0.8px;
  color: #7a6577;
}
.adventure {
  padding: 28px 0 22px;
  border-top: 1px solid #e8dce0;
}
.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 23px;
}
.section-heading h2 {
  font-size: 27px;
  letter-spacing: -0.3px;
  margin-top: 8px;
}
.section-heading .eyebrow {
  font-size: 12px;
  letter-spacing: 0.8px;
}
.adventure-progress {
  font-size: 12px;
  color: #796576;
  padding-bottom: 4px;
}
.level-track {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
}
.level-card {
  display: flex;
  align-items: center;
  gap: 13px;
  text-align: left;
  background: #fffaf3c9;
  border: 1px solid #e7dbdd;
  border-radius: 16px;
  padding: 17px 15px;
  position: relative;
  min-height: 90px;
  box-shadow: 0 3px 0 #e8dce250;
}
.level-card:not(:disabled):hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 0 #e8dce2;
}
.level-card.current {
  border-color: #e9a8c1;
  background: #fff6f5;
  box-shadow: 0 3px 0 #efc4d4;
}
.level-card:disabled {
  opacity: 1;
}
.level-number {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 50%;
  background: #efe7ed;
  color: #a891a6;
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-size: 23px;
  border: 3px solid #fff;
  box-shadow: 0 2px 0 #e3d6df;
}
.level-card.current .level-number {
  background: #ef88aa;
  color: #fff;
  box-shadow: 0 2px 0 #ca6489;
}
.level-card.completed .level-number {
  background: #b8d3b5;
  color: #4c7750;
}
.level-details {
  flex: 1;
}
.level-details small {
  display: block;
  font-size: 12px;
  letter-spacing: 0.8px;
  color: #796578;
  margin-bottom: 6px;
  font-weight: 900;
}
.level-details strong {
  display: block;
  font-size: 14px;
  font-weight: 900;
}
.level-details > span {
  display: block;
  font-size: 12px;
  color: #796475;
  margin-top: 5px;
}
.level-card > svg {
  width: 15px;
  color: #b19dac;
}
.level-card.current > svg {
  color: var(--pink);
}
.level-stars {
  display: flex;
  gap: 1px;
  margin-top: 4px;
}
.level-stars svg {
  width: 11px;
  height: 11px;
  fill: #dfba77;
  color: #dfba77;
}
.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  background: none;
  font-size: 13px;
  font-weight: 800;
  padding: 0;
  color: #826179;
}
.text-button svg {
  width: 17px;
  height: 17px;
}
.text-button:hover {
  color: var(--pink-dark);
}
.all-levels {
  display: flex;
  margin: 21px auto 0;
  font-size: 12px;
}
.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
  border: 1px solid #e5d5df;
  border-radius: 12px;
  padding: 18px 20px;
  margin: 20px 0 18px;
  background: rgba(255, 250, 244, 0.91);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  color: #705a70;
  font-size: 12px;
}
.site-footer button {
  background: none;
  font-size: 12px;
  padding: 0;
  color: #705a70;
  display: flex;
  align-items: center;
  gap: 6px;
}
.site-footer button svg {
  width: 11px;
  height: 11px;
  rotate: -40deg;
}
.footer-center {
  font-size: 12px;
  letter-spacing: 0.8px;
  color: #705a70;
}
.game-heading {
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.game-heading > span {
  font-family: var(--display);
  font-size: 22px;
  color: #9c7b94;
}
.back-arrow {
  transform: rotate(180deg);
}
.game-layout {
  display: grid;
  grid-template-columns: 220px minmax(280px, 520px) 170px;
  gap: 32px;
  justify-content: center;
  align-items: start;
  padding: 14px 0 45px;
}
.score-panel {
  background: #fffbf5d9;
  border: 1px solid #e6d8de;
  border-radius: 24px;
  padding: 23px 20px;
  box-shadow: 0 4px 0 #e6d9e180;
}
.level-label {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.8px;
  color: var(--pink);
  margin-bottom: 10px;
}
.score-panel h2 {
  font-size: 23px;
  line-height: 1.1;
  letter-spacing: -0.2px;
}
.goal-copy {
  color: #7c6477;
  font-size: 14px;
  line-height: 1.8;
  margin-top: 13px;
}
.goal-copy strong {
  color: #795a73;
  font-weight: 900;
}
.score-box {
  margin-top: 21px;
  border-top: 1px dashed #e4d6dd;
  padding-top: 20px;
  text-align: center;
}
.score-box > span {
  font-size: 12px;
  letter-spacing: 0.8px;
  color: #7c6579;
  font-weight: 900;
}
.score-box > strong {
  display: block;
  font-family: var(--display);
  font-weight: 500;
  font-size: 43px;
  line-height: 1.3;
  color: var(--pink);
}
.score-stars {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 7px 0 12px;
}
.score-stars svg {
  fill: #e9e0df;
  color: #ddd1d2;
  width: 25px;
  height: 25px;
}
.score-stars svg:nth-child(2) {
  width: 32px;
  height: 32px;
  margin-top: -5px;
}
.score-stars svg.earned {
  fill: #f4cc68;
  color: #d7ab51;
  filter: drop-shadow(0 2px 0 #e5c583);
}
.progress-track {
  height: 9px;
  border-radius: 20px;
  background: #e8dce4;
  overflow: hidden;
  box-shadow: inset 0 1px 3px #8f748320;
}
.progress-track span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 20px;
  background: linear-gradient(90deg, #f2a1bb, #e65d91);
  transition: width 0.4s;
}
.moves-box {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 13px;
  border-radius: 14px;
  background: #f2eaf6;
  margin-top: 21px;
  padding: 15px 10px;
}
.moves-box > strong {
  font-family: var(--display);
  font-size: 42px;
  font-weight: 500;
  line-height: 1;
  color: #9471a6;
}
.moves-box > span {
  font-size: 12px;
  font-weight: 900;
  color: #7e608b;
  letter-spacing: 0.8px;
  line-height: 1.8;
}
.moves-box small {
  font-weight: 600;
  letter-spacing: 0;
  font-size: 12px;
}
.moves-box.low {
  background: #fce0e6;
}
.moves-box.low strong {
  color: #d85378;
}
.tools {
  display: grid;
  gap: 9px;
  margin-top: 21px;
}
.tool-button {
  display: flex;
  align-items: center;
  gap: 9px;
  text-align: left;
  background: #fff8f0;
  border: 1px solid #e8dce0;
  border-radius: 11px;
  padding: 11px;
  color: #82617b;
  font-size: 12px;
  font-weight: 800;
}
.tool-button svg {
  width: 18px;
  height: 18px;
}
.tool-button span {
  flex: 1;
}
.tool-button b {
  background: #f0e5ec;
  border-radius: 50%;
  width: 19px;
  height: 19px;
  display: grid;
  place-items: center;
  font-size: 12px;
}
.tool-button:hover:not(:disabled) {
  background: #f9e8ee;
}
.board-section {
  min-width: 0;
}
.board-topline {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.8px;
  color: #7b6578;
  margin-bottom: 13px;
  padding: 0 8px;
}
.board-topline > span:first-child {
  display: flex;
  align-items: center;
  gap: 7px;
}
.live-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #99b592;
}
.board-frame {
  position: relative;
  border: 7px solid #fffbf7;
  border-radius: 25px;
  background: #e0cce2;
  padding: 11px;
  box-shadow:
    0 7px 0 #b99cc2,
    0 17px 32px #8a668022,
    inset 0 0 0 2px #cbb1d0;
  isolation: isolate;
}
#gameBoard {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  background: #bca4c7;
  border: 2px solid #b69ac2;
  border-radius: 13px;
  overflow: hidden;
  touch-action: none;
  box-shadow: inset 0 3px 8px #71538330;
}
.board-cell {
  position: absolute;
  width: 12.5%;
  height: 12.5%;
  border: 1px solid #c5accd;
  background: #e9dcef80;
  pointer-events: none;
}
.board-cell.alternate {
  background: #e3cfe9a1;
}
.candy {
  position: absolute;
  left: calc(var(--col) * 12.5%);
  top: calc(var(--row) * 12.5%);
  width: 12.5%;
  height: 12.5%;
  border: 0;
  background: none;
  padding: 4px;
  border-radius: 10px;
  touch-action: none;
  transition:
    left 0.23s cubic-bezier(0.25, 0.7, 0.4, 1),
    top 0.3s cubic-bezier(0.3, 0.7, 0.5, 1),
    background 0.15s;
  z-index: 1;
  user-select: none;
}
.candy img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  transition: transform 0.16s;
}
.candy:hover img {
  transform: scale(1.1) rotate(-5deg);
}
.candy.selected {
  background: #fff7d6b8;
  box-shadow: inset 0 0 0 3px #fff5c3;
  z-index: 3;
}
.candy.selected img {
  transform: scale(1.12);
}
.candy.hinted {
  background: #fff4c7aa;
  animation: hint-glow 0.85s ease-in-out 3;
  z-index: 2;
}
.candy.crushing {
  animation: crush 0.23s ease-in both;
  pointer-events: none;
}
.candy.entering {
  animation: appear 0.32s backwards;
}
.candy.invalid {
  animation: shake 0.3s;
}
.candy:focus-visible {
  outline: 3px solid #fff8d1;
  outline-offset: -4px;
  background: #fff8d13b;
  z-index: 4;
}
.board-message {
  position: absolute;
  left: 50%;
  top: 44%;
  transform: translate(-50%, -50%) scale(0.7);
  font-family: var(--display);
  font-weight: 600;
  font-size: 48px;
  color: #fff3c7;
  text-shadow:
    0 3px 0 #ac5e89,
    2px 0 0 #ac5e89,
    -2px 0 0 #ac5e89,
    0 -2px 0 #ac5e89,
    0 7px 18px #6a327760;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  z-index: 6;
}
.board-message.show {
  animation: message 1.1s ease-out both;
}
.board-instruction {
  text-align: center;
  font-size: 12px;
  color: #705a70;
  margin-top: 23px;
}
.game-note {
  padding-top: 26px;
  text-align: center;
}
.note-candy {
  width: 83px;
  height: 83px;
  margin: 0 auto 20px;
  transform: rotate(17deg);
  filter: drop-shadow(0 8px 5px #9c667726);
}
.note-candy img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.game-note .eyebrow {
  font-size: 12px;
  letter-spacing: 0.8px;
}
.game-note h3 {
  font-size: 29px;
  margin: 12px 0 15px;
  line-height: 1.13;
}
.game-note p {
  font-size: 13px;
  line-height: 1.8;
  color: #7a6578;
}
.mini-match {
  display: flex;
  justify-content: center;
  margin: 21px 0 16px;
  gap: 3px;
}
.mini-match img {
  width: 35px;
  height: 35px;
  object-fit: contain;
}
.game-note .text-button {
  margin-top: 23px;
  font-size: 12px;
}
.score-float {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  color: #fff4c9;
  font-family: var(--display);
  font-weight: 600;
  font-size: 23px;
  text-shadow: 0 2px 2px #8b568b;
  animation: score-up 0.9s forwards;
}
dialog {
  border: 1px solid #eadbe2;
  border-radius: 27px;
  padding: 0;
  width: min(440px, calc(100vw - 32px));
  max-height: 90dvh;
  background: #fffaf3;
  color: var(--ink);
  box-shadow: 0 20px 80px #4b284c44;
}
dialog::backdrop {
  background: #503d5a65;
  backdrop-filter: blur(7px);
}
.modal-inner {
  padding: 37px 32px;
  position: relative;
  text-align: center;
}
.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 29px;
  height: 29px;
}
.modal-close svg {
  width: 15px;
  height: 15px;
}
.modal-eyebrow {
  font-size: 12px;
  letter-spacing: 0.8px;
  color: var(--pink);
  font-weight: 900;
  margin-bottom: 10px;
}
.modal-inner h2 {
  font-size: 36px;
  line-height: 1.1;
  margin: 10px 0 16px;
}
.modal-inner > div > p {
  font-size: 14px;
  color: #7b6579;
  line-height: 1.8;
}
.modal-inner .primary-button {
  font-size: 14px;
  width: 100%;
  margin-top: 23px;
  padding: 14px 20px;
}
.secondary-button {
  background: #f3e8ee;
  border: 1px solid #e4d5e1;
  border-radius: 13px;
  width: 100%;
  padding: 13px;
  color: #8e6b86;
  font-weight: 800;
  font-size: 14px;
  margin-top: 14px;
}
.secondary-button:hover {
  background: #eddae5;
}
.help-steps {
  display: grid;
  gap: 16px;
  margin: 25px 0;
  text-align: left;
}
.help-step {
  display: flex;
  align-items: center;
  gap: 14px;
}
.help-step > b {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #f6dfeb;
  font-family: var(--display);
  font-size: 17px;
  color: var(--pink-dark);
}
.help-step strong {
  font-size: 14px;
  display: block;
}
.help-step p {
  font-size: 13px;
  line-height: 1.7;
  color: #796478;
  margin-top: 3px;
}
.keyboard-note {
  font-size: 12px !important;
  padding-top: 18px;
  border-top: 1px dashed #e4d8df;
}
kbd {
  padding: 1px 5px;
  background: #eee3ed;
  border: 1px solid #dacbdc;
  border-radius: 4px;
  font: inherit;
  font-weight: 800;
}
.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 19px 0;
  border-bottom: 1px solid #ede2e7;
  text-align: left;
}
.setting-row strong {
  font-size: 14px;
  display: block;
}
.setting-row small {
  font-size: 12px;
  color: #796577;
  display: block;
  margin-top: 4px;
}
.switch {
  width: 45px;
  height: 25px;
  border-radius: 20px;
  background: #dacbd8;
  padding: 3px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.switch:after {
  content: "";
  width: 19px;
  height: 19px;
  background: #fffaf5;
  border-radius: 50%;
  box-shadow: 0 1px 4px #82647b30;
  transition: transform 0.2s;
}
.switch[aria-checked="true"] {
  background: #e77b9f;
}
.switch[aria-checked="true"]:after {
  transform: translateX(20px);
}
.volume-range {
  width: 100%;
  accent-color: var(--pink);
  margin-top: 14px;
  cursor: pointer;
}
.result-stars {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 10px 0 23px;
}
.result-stars svg {
  width: 45px;
  height: 45px;
  color: #dfb45f;
  fill: #f3ce73;
  filter: drop-shadow(0 3px 0 #dfb66f);
}
.result-stars svg:nth-child(2) {
  width: 57px;
  height: 57px;
  margin-top: -8px;
}
.result-stars svg.empty {
  fill: #e6dce1;
  color: #dbd0d8;
  filter: none;
}
.result-score {
  font-family: var(--display);
  font-size: 50px;
  color: var(--pink);
  margin-top: 15px;
}
.result-score small {
  display: block;
  font-family: var(--font);
  font-size: 12px;
  letter-spacing: 0.8px;
  color: #796477;
}
.modal-levels {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 23px;
}
.modal-level {
  background: #f3e9ef;
  border: 1px solid #e5d7e3;
  border-radius: 13px;
  padding: 15px 5px;
  font-family: var(--display);
  font-size: 24px;
  display: grid;
  justify-items: center;
  gap: 7px;
}
.modal-level > svg {
  width: 15px;
  height: 15px;
  color: #b8a6b7;
}
.modal-level.current {
  background: #fbe3ed;
  border-color: #e99ebd;
  color: var(--pink-dark);
}
.modal-level .level-stars {
  margin: 0;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
@keyframes float {
  0%,
  100% {
    translate: 0 0;
  }
  50% {
    translate: 0 -12px;
  }
}
@keyframes crush {
  0% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.2);
    filter: brightness(1.3);
  }
  100% {
    transform: scale(0) rotate(20deg);
    opacity: 0;
  }
}
@keyframes appear {
  from {
    translate: 0 var(--spawn-offset, -55px);
    opacity: 0;
  }
  to {
    translate: 0 0;
    opacity: 1;
  }
}
@keyframes hint-glow {
  50% {
    box-shadow:
      inset 0 0 0 3px #fff6ca,
      0 0 18px #fff4c8;
    transform: scale(0.93);
  }
}
@keyframes shake {
  25%,
  75% {
    translate: -4px;
  }
  50% {
    translate: 4px;
  }
}
@keyframes score-up {
  from {
    opacity: 1;
    translate: 0 0;
  }
  to {
    opacity: 0;
    translate: 0 -65px;
  }
}
@keyframes message {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.6);
  }
  20%,
  70% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -75%) scale(1.05);
  }
}
@media (min-width: 1400px) {
  .app-shell {
    padding: 0 64px;
  }
  .hero {
    min-height: 560px;
    padding: 46px 0 50px;
  }
  .hero-art {
    height: 460px;
  }
  .preview-board-wrap {
    width: 350px;
  }
  .level-card {
    padding: 20px 17px;
  }
  .adventure {
    padding-top: 30px;
    padding-bottom: 26px;
  }
}
@media (max-width: 1100px) {
  .app-shell {
    padding: 0 35px;
  }
  .sound-status {
    display: none;
  }
  .header-nav {
    margin: 0;
  }
  .hero {
    gap: 15px;
  }
  h1 {
    font-size: 66px;
    max-width: 365px;
  }
  .title-spark {
    right: -1px;
    width: 30px;
  }
  .hero-art {
    height: 415px;
  }
  .preview-board-wrap {
    width: 295px;
  }
  .art-orbit {
    width: 325px;
    height: 325px;
  }
  .candy-one {
    left: -12px;
    width: 75px;
  }
  .candy-two {
    right: -5px;
    width: 70px;
  }
  .match-bubble {
    right: -12px;
  }
  .hero-copy > p {
    font-size: 14px;
  }
  .game-layout {
    grid-template-columns: 200px minmax(280px, 520px);
    gap: 25px;
  }
  .game-note {
    display: none;
  }
  .level-card {
    padding: 15px 11px;
    gap: 9px;
  }
  .level-number {
    width: 35px;
    height: 35px;
    font-size: 20px;
  }
  .level-details strong {
    font-size: 12px;
  }
}
@media (max-width: 760px) {
  .app-shell {
    padding: 0 23px;
  }
  .site-header {
    height: 94px;
    gap: 12px;
  }
  .brand {
    font-size: 26px;
    gap: 7px;
  }
  .brand small {
    font-size: 10px;
    letter-spacing: 0.8px;
  }
  .brand-mark {
    scale: 0.85;
    width: 34px;
  }
  .header-nav {
    gap: 16px;
  }
  .nav-link {
    font-size: 13px;
  }
  .header-actions {
    gap: 7px;
  }
  .icon-button {
    width: 35px;
    height: 35px;
  }
  .hero {
    grid-template-columns: 1fr 1fr;
    min-height: 460px;
    padding: 36px 0 32px;
    gap: 0;
  }
  h1 {
    font-size: 53px;
    letter-spacing: -1.5px;
    margin-top: 17px;
  }
  .hero-copy .eyebrow {
    font-size: 12px;
    letter-spacing: 0.8px;
  }
  .title-spark {
    right: 10px;
    width: 24px;
    top: -14px;
  }
  .hero-copy > p {
    font-size: 13px;
  }
  .primary-button {
    font-size: 15px;
    padding: 15px 20px;
    border-radius: 14px;
  }
  .play-button {
    min-width: 195px;
    margin-top: 22px;
  }
  .hero-note {
    font-size: 12px;
  }
  .personal-best {
    margin-top: 23px;
  }
  .personal-best strong {
    font-size: 12px;
  }
  .hero-art {
    height: 355px;
    margin-left: 12px;
  }
  .preview-board-wrap {
    width: 240px;
    padding: 17px 9px 9px;
    border-width: 5px;
    border-radius: 22px;
  }
  .preview-board {
    padding: 5px;
    gap: 2px;
  }
  .preview-ribbon {
    font-size: 12px;
    padding: 8px 4px;
    top: -19px;
    left: 6%;
    right: 1%;
  }
  .art-orbit {
    width: 250px;
    height: 250px;
  }
  .floating-candy.candy-one {
    width: 59px;
    height: 59px;
    top: 37px;
    left: -16px;
  }
  .floating-candy.candy-two {
    width: 59px;
    height: 59px;
    right: -14px;
    top: 24px;
  }
  .floating-candy.candy-three {
    width: 57px;
    height: 57px;
    bottom: 39px;
    left: -3px;
  }
  .spark-one {
    width: 30px;
    height: 30px;
    top: 0;
    left: 65px;
  }
  .spark-two {
    width: 23px;
    height: 23px;
    right: -14px;
    bottom: 100px;
  }
  .match-bubble {
    padding: 11px 14px;
    bottom: 10px;
    right: -6px;
    border-radius: 13px;
  }
  .match-bubble strong {
    font-size: 24px;
  }
  .match-bubble > span:last-child {
    font-size: 12px;
  }
  .bubble-stars svg {
    width: 10px;
    height: 10px;
  }
  .art-caption {
    font-size: 12px;
    letter-spacing: 0.8px;
    bottom: -12px;
  }
  .section-heading h2 {
    font-size: 23px;
  }
  .level-track {
    grid-template-columns: repeat(2, 1fr);
    gap: 11px;
  }
  .level-details strong {
    font-size: 14px;
  }
  .level-card {
    padding: 15px;
  }
  .level-number {
    width: 40px;
    height: 40px;
  }
  .adventure {
    padding-top: 23px;
  }
  .game-layout {
    grid-template-columns: 170px minmax(260px, 1fr);
    gap: 18px;
    padding-bottom: 36px;
  }
  .score-panel {
    padding: 20px 15px;
  }
  .score-panel h2 {
    font-size: 21px;
  }
  .game-heading {
    height: 70px;
  }
  .game-heading > span {
    font-size: 17px;
  }
  .game-heading .text-button {
    font-size: 12px;
  }
  .board-frame {
    padding: 7px;
    border-width: 5px;
    border-radius: 19px;
  }
  .candy {
    padding: 3px;
  }
  .board-topline {
    font-size: 12px;
    letter-spacing: 0.5px;
    padding: 0 2px;
  }
  .board-instruction {
    font-size: 12px;
    line-height: 1.6;
  }
  .board-message {
    font-size: 35px;
  }
  .footer-center {
    display: none;
  }
}
@media (max-width: 540px) {
  .level-track {
    grid-template-columns: 1fr;
  }
  .level-details {
    min-width: 0;
  }
  .site-footer button {
    min-height: 32px;
  }
  .app-shell {
    padding: 0 20px;
  }
  .site-header {
    height: 85px;
  }
  .header-nav {
    display: none;
  }
  .brand {
    font-size: 27px;
  }
  .hero {
    display: flex;
    flex-direction: column;
    text-align: center;
    padding-top: 35px;
    gap: 18px;
  }
  .hero-copy .eyebrow {
    justify-content: center;
    font-size: 12px;
  }
  .hero-copy {
    z-index: 2;
  }
  h1 {
    font-size: clamp(50px, 16.5vw, 65px);
    letter-spacing: -1.5px;
    margin: 18px auto;
    line-height: 1.02;
  }
  .title-spark {
    right: 4px;
    top: 0;
    width: 29px;
  }
  .hero-copy > p {
    font-size: 14px;
    line-height: 1.8;
  }
  .play-button {
    min-width: 225px;
    font-size: 17px;
    margin-top: 24px;
  }
  .hero-note {
    justify-content: center;
    font-size: 12px;
    margin-top: 18px;
  }
  .personal-best {
    display: none;
  }
  .hero-art {
    width: 100%;
    max-width: 340px;
    height: 350px;
    margin: 0;
  }
  .preview-board-wrap {
    width: 264px;
  }
  .art-orbit {
    width: 275px;
    height: 275px;
  }
  .art-orbit:after {
    inset: -12px;
  }
  .floating-candy.candy-one {
    top: 27px;
    left: 3px;
    width: 64px;
    height: 64px;
  }
  .floating-candy.candy-two {
    right: 0;
    top: 28px;
    width: 66px;
    height: 66px;
  }
  .floating-candy.candy-three {
    left: 6px;
    bottom: 26px;
    width: 64px;
    height: 64px;
  }
  .match-bubble {
    right: -1px;
    bottom: 6px;
  }
  .art-caption {
    bottom: -16px;
  }
  .hero {
    padding-bottom: 49px;
  }
  .section-heading {
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
  }
  .section-heading h2 {
    font-size: 22px;
    max-width: 220px;
  }
  .section-heading .eyebrow {
    font-size: 12px;
  }
  .adventure-progress {
    font-size: 12px;
    max-width: 80px;
    text-align: right;
    line-height: 1.8;
  }
  .level-card {
    padding: 13px 10px;
    gap: 8px;
    min-height: 85px;
  }
  .level-number {
    width: 33px;
    height: 33px;
    font-size: 18px;
  }
  .level-details strong {
    font-size: 12px;
  }
  .level-details small {
    font-size: 12px;
    letter-spacing: 0.5px;
  }
  .level-details > span {
    font-size: 12px;
  }
  .level-card > svg {
    width: 12px;
  }
  .site-footer {
    padding: 16px 12px;
    font-size: 12px;
  }
  .site-footer button {
    font-size: 12px;
  }
  .game-heading {
    height: 65px;
  }
  .game-heading > span {
    font-size: 15px;
  }
  .game-heading .text-button {
    font-size: 0;
    gap: 0;
  }
  .game-heading .text-button svg {
    width: 22px;
    height: 22px;
  }
  .game-layout {
    display: flex;
    flex-direction: column;
    gap: 23px;
    padding-top: 0;
  }
  .score-panel {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr 65px;
    column-gap: 13px;
    align-items: center;
    border-radius: 17px;
    padding: 15px;
    position: relative;
  }
  .level-label {
    font-size: 12px;
    letter-spacing: 0.8px;
    margin-bottom: 6px;
  }
  .score-panel h2 {
    font-size: 15px;
    grid-column: 1;
    grid-row: 2;
  }
  .goal-copy {
    font-size: 12px;
    grid-row: 3;
    grid-column: 1;
    margin: 3px 0 0;
    line-height: 1.6;
  }
  .goal-copy br {
    display: none;
  }
  .goal-copy strong {
    display: block;
  }
  .score-box {
    grid-column: 2;
    grid-row: 1/4;
    padding: 0;
    margin: 0;
    border: 0;
  }
  .score-box > span {
    font-size: 12px;
    letter-spacing: 0.8px;
  }
  .score-box > strong {
    font-size: 29px;
  }
  .score-stars {
    margin: 3px 0 8px;
    gap: 5px;
  }
  .score-stars svg {
    width: 15px;
    height: 15px;
  }
  .score-stars svg:nth-child(2) {
    width: 20px;
    height: 20px;
    margin-top: -3px;
  }
  .progress-track {
    height: 6px;
  }
  .moves-box {
    grid-column: 3;
    grid-row: 1/4;
    display: block;
    text-align: center;
    padding: 10px 4px;
    margin: 0;
    border-radius: 11px;
  }
  .moves-box > strong {
    display: block;
    font-size: 30px;
  }
  .moves-box > span {
    font-size: 12px;
    letter-spacing: 0.5px;
  }
  .moves-box small {
    display: none;
  }
  .tools {
    grid-column: 1/-1;
    grid-row: 4;
    display: flex;
    gap: 8px;
    margin-top: 12px;
  }
  .tool-button {
    padding: 8px 10px;
    flex: 1;
    font-size: 12px;
    border-radius: 9px;
  }
  .tool-button svg {
    width: 15px;
    height: 15px;
  }
  .tool-button b {
    width: 17px;
    height: 17px;
    font-size: 12px;
  }
  .board-section {
    width: 100%;
  }
  .board-topline {
    font-size: 12px;
    letter-spacing: 0.7px;
    margin-bottom: 10px;
  }
  .board-frame {
    padding: 7px;
    border-width: 5px;
    border-radius: 20px;
  }
  .board-instruction {
    font-size: 12px;
    margin-top: 22px;
  }
  .board-message {
    font-size: 36px;
  }
  .modal-inner {
    padding: 37px 25px;
  }
  .modal-inner h2 {
    font-size: 32px;
  }
  .landscape {
    background-position: 35% bottom;
  }
  .score-float {
    font-size: 19px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
/* Room for readable copy: sections reflow before their text gets squeezed. */
.section-heading,
.hub-heading {
  gap: 20px;
  flex-wrap: wrap;
}
.section-heading > div,
.hero-copy,
.level-details,
.header-nav,
.setting-row > div {
  min-width: 0;
}
.setting-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
}
.setting-row small {
  line-height: 1.6;
}
.setting-row .switch {
  justify-self: end;
}
.tools .tool-button {
  min-height: 44px;
}
@media (min-width: 1101px) {
  .game-layout {
    grid-template-columns: 220px minmax(320px, 520px) 230px;
    gap: 24px;
  }
}
@media (min-width: 541px) and (max-width: 1100px) {
  .app-shell:not(:has(> #duelScreen[data-view="match"]:not([hidden])))
    .site-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    height: auto;
    min-height: 112px;
    padding-block: 18px;
    gap: 16px 24px;
  }
  .site-header .brand {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
  }
  .site-header .header-actions {
    grid-column: 2;
    grid-row: 1;
  }
  .site-header .header-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: center;
    width: 100%;
    margin: 0;
    gap: 24px;
  }
  .app-shell:has(> #duelScreen[data-view="match"]:not([hidden])) .header-nav {
    display: none;
  }
}
@media (min-width: 541px) and (max-width: 900px) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
    text-align: center;
  }
  .hero-copy {
    max-width: 560px;
    justify-self: center;
  }
  .hero-copy .eyebrow,
  .play-mode-actions,
  .hero-note,
  .personal-best {
    justify-content: center;
  }
  .hero-copy h1 {
    margin-inline: auto;
  }
  .hero-copy > p {
    max-width: 480px;
    margin-inline: auto;
  }
  .hero-art {
    width: min(100%, 480px);
    max-width: 100%;
    margin-inline: auto;
    justify-self: center;
  }
}
@media (max-width: 540px) {
  .brand small {
    letter-spacing: 0;
    line-height: 1.25;
  }
  .hero {
    padding-bottom: 32px;
  }
  .section-heading {
    align-items: flex-start;
    gap: 12px;
  }
  .section-heading > div {
    flex-basis: 100%;
  }
  .section-heading h2 {
    margin-bottom: 0;
  }
  .site-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    padding: 18px;
  }
  .score-panel {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px 14px;
    padding: 18px;
  }
  .level-label {
    grid-column: 1;
    grid-row: 1;
    margin: 0;
  }
  .score-panel h2 {
    grid-column: 1;
    grid-row: 2;
    margin: 0;
  }
  .goal-copy {
    grid-column: 2;
    grid-row: 1 / 3;
    align-self: center;
    margin: 0;
    text-align: right;
  }
  .score-box {
    grid-column: 1;
    grid-row: 3;
    padding: 12px 8px;
    background: #fffaf8;
    border: 1px solid #eadce4;
    border-radius: 12px;
  }
  .score-box > span {
    display: block;
    white-space: nowrap;
  }
  .moves-box {
    grid-column: 2;
    grid-row: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 8px;
  }
  .moves-box > span {
    order: -1;
    margin-bottom: 8px;
    white-space: nowrap;
  }
  .moves-box br {
    display: none;
  }
  .record-status {
    grid-column: 1 / -1;
    grid-row: 4;
    margin: 0;
  }
  .tools {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-column: 1 / -1;
    grid-row: 5;
    margin: 0;
    gap: 10px;
  }
  .tool-button {
    min-width: 0;
    gap: 6px;
    padding: 10px 8px;
  }
  .board-topline {
    flex-wrap: wrap;
    gap: 8px;
    line-height: 1.5;
  }
  .modal-inner {
    padding: 48px 22px 28px;
  }
}
@media (max-width: 380px) {
  .tools {
    grid-template-columns: 1fr;
  }
  .tool-button {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr) 22px;
    text-align: left;
    padding: 10px 12px;
  }
}
@media (min-width: 541px) and (max-width: 1100px) {
  .level-track {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 540px) {
  .score-box,
  .moves-box {
    align-self: stretch;
  }
  .brand small {
    text-wrap: balance;
  }
}
