:root {
  --game-ink: #0b1730;
  --game-forest-950: #0d3025;
  --game-forest-850: #154b39;
  --game-forest-700: #236b54;
  --game-lake: #72adb0;
  --game-lake-soft: #d9efec;
  --game-cream: #f7f4ec;
  --game-paper: #fffdf8;
  --game-clay: #df825f;
  --game-gold: #e9bc63;
  --game-line: rgba(13, 48, 37, .15);
  --game-shadow: 0 28px 80px rgba(13, 48, 37, .16);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body.memory-page {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--game-ink);
  background:
    radial-gradient(circle at 10% 10%, rgba(114, 173, 176, .16), transparent 28rem),
    linear-gradient(180deg, #fbfaf6, #fff 45%, #f3f7f4);
  font-family: var(--font-family-base);
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

.skip-link {
  position: fixed;
  z-index: 200;
  top: .6rem;
  left: .6rem;
  padding: .8rem 1rem;
  border-radius: .75rem;
  color: #fff;
  background: var(--game-forest-950);
  font-weight: 800;
  text-decoration: none;
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.game-topbar {
  position: sticky;
  z-index: 100;
  top: 0;
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .65rem max(1rem, calc((100vw - 1180px) / 2));
  border-bottom: 1px solid var(--game-line);
  background: rgba(255, 253, 248, .9);
  backdrop-filter: blur(18px);
}

.game-brand {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  color: var(--game-forest-950);
  font-family: var(--font-family-display);
  font-size: .96rem;
  font-weight: 850;
  text-decoration: none;
}

.game-brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--game-forest-850);
  box-shadow: 0 8px 20px rgba(13, 48, 37, .18);
}

.game-brand-mark svg {
  width: 27px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.game-top-actions {
  display: flex;
  align-items: center;
  gap: .55rem;
}

.sound-button,
.exit-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  padding: .65rem .9rem;
  border: 1px solid var(--game-line);
  border-radius: 999px;
  color: var(--game-forest-950);
  background: rgba(255, 255, 255, .84);
  font-size: .82rem;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease, color 180ms ease;
}

.sound-button[aria-pressed="true"] {
  color: #fff;
  background: var(--game-forest-850);
}

.sound-button:hover,
.exit-link:hover {
  transform: translateY(-1px);
}

.sound-icon {
  width: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sound-button[aria-pressed="true"] .sound-icon-off,
.sound-button[aria-pressed="false"] .sound-icon-on {
  display: none;
}

.game-screen {
  position: relative;
}

.game-screen.is-active {
  animation: screen-arrive 550ms cubic-bezier(.2, .8, .2, 1) both;
}

@keyframes screen-arrive {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.welcome-screen {
  isolation: isolate;
  min-height: calc(100vh - 72px);
  padding: clamp(2.5rem, 6vw, 6.5rem) max(1rem, calc((100vw - 1180px) / 2)) 4rem;
  overflow: hidden;
  background:
    linear-gradient(115deg, rgba(247, 244, 236, .98) 0 48%, rgba(247, 244, 236, .84) 63%, rgba(247, 244, 236, .3)),
    url('../images/backe-game/dandelion-meadow.webp') center / cover;
}

.welcome-atmosphere {
  position: absolute;
  z-index: -1;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.atmosphere-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
  opacity: .6;
  animation: orb-drift 9s ease-in-out infinite alternate;
}

.atmosphere-orb-one {
  width: 22rem;
  height: 22rem;
  top: -9rem;
  right: 18%;
  background: rgba(114, 173, 176, .3);
}

.atmosphere-orb-two {
  width: 17rem;
  height: 17rem;
  bottom: -7rem;
  left: 28%;
  background: rgba(223, 130, 95, .2);
  animation-delay: -3s;
}

@keyframes orb-drift {
  to { transform: translate3d(1rem, -1rem, 0) scale(1.05); }
}

.welcome-layout {
  display: grid;
  width: min(1180px, 100%);
  margin-inline: auto;
  align-items: center;
  grid-template-columns: minmax(0, .92fr) minmax(380px, .78fr);
  gap: clamp(2.5rem, 6vw, 6rem);
}

.welcome-copy {
  max-width: 680px;
}

.game-kicker {
  display: inline-flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1.1rem;
  color: var(--game-forest-700);
  font-size: .75rem;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.game-kicker::before {
  width: 36px;
  height: 2px;
  background: var(--game-clay);
  content: "";
}

.welcome-copy h1 {
  max-width: 8ch;
  margin: 0 0 1.35rem;
  color: var(--game-ink);
  font-family: var(--font-family-display);
  font-size: clamp(4.5rem, 10vw, 8.6rem);
  font-weight: 850;
  letter-spacing: -.055em;
  line-height: .76;
}

.welcome-copy h1 span {
  display: block;
  margin-top: .22em;
  color: var(--game-forest-700);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: .7em;
  font-style: italic;
  font-weight: 500;
  letter-spacing: -.055em;
}

.welcome-lead {
  max-width: 31ch;
  margin: 0 0 .75rem;
  color: var(--game-forest-950);
  font-family: var(--font-family-display);
  font-size: clamp(1.35rem, 2.4vw, 2rem);
  font-weight: 750;
  line-height: 1.18;
}

.welcome-body {
  max-width: 58ch;
  margin: 0 0 1.7rem;
  color: #3f574e;
  font-size: clamp(1rem, 1.4vw, 1.12rem);
  line-height: 1.65;
}

.music-choice {
  display: flex;
  width: fit-content;
  max-width: 100%;
  align-items: center;
  gap: .85rem;
  padding: .9rem 1rem;
  border: 1px solid rgba(13, 48, 37, .12);
  border-radius: 1rem;
  background: rgba(255, 255, 255, .72);
  box-shadow: 0 12px 30px rgba(13, 48, 37, .07);
  cursor: pointer;
}

.music-choice input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.choice-control {
  position: relative;
  flex: 0 0 48px;
  width: 48px;
  height: 28px;
  border-radius: 999px;
  background: #bac7c1;
  transition: background 180ms ease;
}

.choice-control::after {
  position: absolute;
  width: 22px;
  height: 22px;
  top: 3px;
  left: 3px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 3px 8px rgba(13, 48, 37, .18);
  content: "";
  transition: transform 180ms ease;
}

.music-choice input:checked + .choice-control {
  background: var(--game-forest-700);
}

.music-choice input:checked + .choice-control::after {
  transform: translateX(20px);
}

.music-choice input:focus-visible + .choice-control {
  outline: 3px solid rgba(35, 107, 84, .42);
  outline-offset: 3px;
}

.music-choice strong,
.music-choice small {
  display: block;
}

.music-choice strong {
  color: var(--game-forest-950);
  font-size: .92rem;
}

.music-choice small {
  margin-top: .2rem;
  color: #60736b;
  font-size: .76rem;
}

.welcome-actions,
.complete-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem;
  margin-top: 1.25rem;
}

.primary-game-button {
  display: inline-flex;
  min-height: 56px;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  padding: .9rem 1.3rem .9rem 1.55rem;
  border: 0;
  border-radius: 999px;
  color: var(--game-forest-950);
  background: linear-gradient(135deg, var(--game-forest-850), var(--game-forest-700));
  box-shadow: 0 18px 36px rgba(13, 48, 37, .24);
  font-family: var(--font-family-display);
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.primary-game-button:hover:not(:disabled) {
  box-shadow: 0 22px 44px rgba(13, 48, 37, .28);
  transform: translateY(-2px);
}

.primary-game-button:disabled {
  cursor: wait;
  opacity: .55;
}

.primary-game-button svg {
  width: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.quiet-button,
.quiet-link {
  min-height: 44px;
  padding: .72rem .95rem;
  border: 0;
  border-radius: .75rem;
  color: var(--game-forest-850);
  background: transparent;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: .25em;
  cursor: pointer;
}

.gentle-note {
  display: flex;
  align-items: center;
  gap: .55rem;
  margin: 1.1rem 0 0;
  color: #60736b;
  font-size: .82rem;
  font-weight: 650;
}

.gentle-note svg {
  width: 20px;
  flex: 0 0 20px;
  fill: none;
  stroke: var(--game-forest-700);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.load-message {
  min-height: 1.2em;
  margin: .7rem 0 0;
  color: #7b5141;
  font-size: .82rem;
}

.welcome-gallery {
  position: relative;
  min-height: 590px;
}

.welcome-gallery figure {
  position: absolute;
  margin: 0;
  overflow: hidden;
  border: 6px solid rgba(255, 255, 255, .86);
  background: #d7e4de;
  box-shadow: var(--game-shadow);
}

.welcome-gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-main {
  width: min(92%, 510px);
  height: 520px;
  right: 0;
  top: 0;
  border-radius: 48% 48% 44% 44% / 34% 34% 56% 56%;
}

.gallery-main::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 56%, rgba(6, 30, 23, .72));
  content: "";
}

.gallery-main figcaption {
  position: absolute;
  z-index: 2;
  right: 2rem;
  bottom: 1.7rem;
  left: 2rem;
  color: #fff;
}

.gallery-main figcaption span,
.gallery-main figcaption strong {
  display: block;
}

.gallery-main figcaption span {
  margin-bottom: .3rem;
  color: #cfe9df;
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.gallery-main figcaption strong {
  font-family: var(--font-family-display);
  font-size: 1.4rem;
}

.gallery-small {
  z-index: 3;
  width: 158px;
  height: 158px;
  border-radius: 38% 62% 48% 52% / 48% 38% 62% 52%;
}

.gallery-flower {
  left: -1rem;
  bottom: 1rem;
  transform: rotate(-5deg);
}

.gallery-lake {
  width: 126px;
  height: 126px;
  right: -1.4rem;
  top: 2.2rem;
  transform: rotate(5deg);
}

.gallery-badge {
  position: absolute;
  z-index: 4;
  display: grid;
  width: 106px;
  height: 106px;
  left: 1.4rem;
  top: 2rem;
  place-items: center;
  border: 5px solid rgba(255, 255, 255, .84);
  border-radius: 50%;
  color: var(--game-forest-950);
  background: var(--game-clay);
  box-shadow: 0 18px 38px rgba(87, 43, 26, .2);
  font-size: .82rem;
  font-weight: 900;
  line-height: 1.35;
  text-align: center;
  transform: rotate(-7deg);
}

.play-screen {
  min-height: calc(100vh - 72px);
  padding: clamp(2rem, 5vw, 4.5rem) 1rem 5rem;
}

.play-shell {
  width: min(1180px, 100%);
  margin-inline: auto;
}

.chapter-progress {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: .6rem;
  margin-bottom: clamp(2rem, 4vw, 3.5rem);
}

.chapter-step {
  position: relative;
  display: flex;
  min-width: 0;
  align-items: center;
  gap: .6rem;
  padding: .68rem .75rem;
  border: 1px solid var(--game-line);
  border-radius: 999px;
  color: #6b7c75;
  background: rgba(255, 255, 255, .74);
  font-size: .75rem;
  font-weight: 800;
}

.chapter-step-number {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  place-items: center;
  border-radius: 50%;
  background: #e8efeb;
}

.chapter-step-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chapter-step.is-current {
  color: #fff;
  border-color: var(--game-forest-850);
  background: var(--game-forest-850);
  box-shadow: 0 12px 24px rgba(13, 48, 37, .17);
}

.chapter-step.is-current .chapter-step-number {
  color: var(--game-forest-950);
  background: #fff;
}

.chapter-step.is-complete {
  color: var(--game-forest-850);
  border-color: rgba(35, 107, 84, .23);
  background: #e9f4ef;
}

.play-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 1.6rem;
}

.play-heading h2,
.complete-copy h2 {
  margin: 0 0 .55rem;
  color: var(--game-ink);
  font-family: var(--font-family-display);
  font-size: clamp(2.4rem, 6vw, 5rem);
  letter-spacing: -.065em;
  line-height: .92;
}

.play-heading p {
  max-width: 62ch;
  margin: 0;
  color: #52675f;
  font-size: 1.04rem;
  line-height: 1.55;
}

.play-stats {
  display: flex;
  flex: 0 0 auto;
  gap: .6rem;
}

.play-stats div {
  min-width: 104px;
  padding: .75rem .9rem;
  border: 1px solid var(--game-line);
  border-radius: 1rem;
  background: rgba(255, 255, 255, .84);
}

.play-stats span,
.play-stats strong {
  display: block;
}

.play-stats span {
  margin-bottom: .18rem;
  color: #667a72;
  font-size: .68rem;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.play-stats strong {
  color: var(--game-forest-950);
  font-family: var(--font-family-display);
  font-size: 1.22rem;
}

.board-stage {
  position: relative;
  isolation: isolate;
  min-height: 440px;
  padding: clamp(1rem, 3vw, 2rem);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: clamp(1.6rem, 4vw, 3rem);
  color: #fff;
  background:
    radial-gradient(circle at 90% 0%, rgba(114, 173, 176, .32), transparent 28rem),
    radial-gradient(circle at 0% 100%, rgba(223, 130, 95, .16), transparent 24rem),
    var(--game-forest-950);
  box-shadow: 0 35px 85px rgba(13, 48, 37, .22);
}

.board-ambient {
  position: absolute;
  z-index: -1;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 50%;
  pointer-events: none;
}

.board-ambient-one {
  width: 420px;
  height: 420px;
  top: -250px;
  right: 4%;
}

.board-ambient-two {
  width: 310px;
  height: 310px;
  bottom: -210px;
  left: 8%;
}

.board-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.3rem;
  color: rgba(255, 255, 255, .82);
  font-size: .88rem;
  font-weight: 700;
}

.board-reset {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  gap: .45rem;
  padding: .55rem .8rem;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 999px;
  color: #fff;
  background: rgba(255, 255, 255, .08);
  font-size: .78rem;
  font-weight: 800;
  cursor: pointer;
}

.board-reset svg {
  width: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.memory-grid {
  display: grid;
  width: 100%;
  align-items: stretch;
  justify-content: center;
  grid-template-columns: repeat(var(--columns, 3), minmax(0, 150px));
  gap: clamp(.55rem, 1.3vw, .85rem);
}

.memory-card {
  position: relative;
  width: 100%;
  min-width: 0;
  aspect-ratio: .82;
  padding: 0;
  border: 0;
  border-radius: 1.1rem;
  background: transparent;
  cursor: pointer;
  -webkit-perspective: 900px;
  perspective: 900px;
}

.memory-card-inner {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  inset: 0;
  -webkit-transform-style: preserve-3d;
  transform-style: preserve-3d;
  transition: transform 540ms cubic-bezier(.2, .75, .2, 1);
}

.memory-card.is-flipped .memory-card-inner,
.memory-card.is-matched .memory-card-inner {
  transform: rotateY(180deg);
}

.memory-card-face {
  position: absolute;
  display: grid;
  width: 100%;
  height: 100%;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  inset: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 1.1rem;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  box-shadow: 0 13px 25px rgba(0, 0, 0, .2);
}

.memory-card-front {
  place-items: center;
  background:
    radial-gradient(circle at 76% 18%, rgba(255, 255, 255, .19), transparent 4rem),
    linear-gradient(145deg, #32735e, #1a523f);
}

.memory-card-front::before,
.memory-card-front::after {
  position: absolute;
  width: 130%;
  height: 46%;
  left: -20%;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 50%;
  content: "";
  transform: rotate(-10deg);
}

.memory-card-front::before { bottom: 5%; }
.memory-card-front::after { bottom: -7%; }

.memory-card-back {
  background: #fff;
  -webkit-transform: rotateY(180deg);
  transform: rotateY(180deg);
}

@supports not (aspect-ratio: 1 / 1) {
  .memory-card {
    height: clamp(110px, 36vw, 183px);
  }
}

.memory-card-back img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.memory-card-back::after {
  position: absolute;
  inset: 45% 0 0;
  background: linear-gradient(180deg, transparent, rgba(4, 24, 18, .83));
  content: "";
}

.card-title {
  position: absolute;
  z-index: 2;
  right: .65rem;
  bottom: .6rem;
  left: .65rem;
  color: #fff;
  font-family: var(--font-family-display);
  font-size: clamp(.68rem, 1.2vw, .83rem);
  font-weight: 800;
  line-height: 1.08;
  text-align: left;
  text-shadow: 0 1px 8px rgba(0, 0, 0, .38);
}

.memory-card:hover:not(.is-flipped):not(.is-matched) .memory-card-inner {
  transform: translateY(-4px) rotateX(2deg);
}

.memory-card.is-matched {
  cursor: default;
}

.memory-card.is-matched .memory-card-face {
  border-color: rgba(233, 188, 99, .85);
  box-shadow: 0 0 0 3px rgba(233, 188, 99, .22), 0 14px 28px rgba(0, 0, 0, .2);
}

.memory-card.is-matched::after {
  position: absolute;
  z-index: 5;
  display: grid;
  width: 28px;
  height: 28px;
  top: .45rem;
  right: .45rem;
  place-items: center;
  border-radius: 50%;
  color: var(--game-forest-950);
  background: var(--game-gold);
  box-shadow: 0 5px 12px rgba(0, 0, 0, .2);
  content: "✓";
  font-size: .88rem;
  font-weight: 950;
}

.board-encouragement {
  margin: 1.3rem 0 0;
  color: rgba(255, 255, 255, .67);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: .94rem;
  font-style: italic;
  text-align: center;
}

.match-story {
  position: fixed;
  z-index: 120;
  display: grid;
  width: min(560px, calc(100% - 2rem));
  right: 1rem;
  bottom: 1rem;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 1rem;
  padding: .8rem;
  border: 1px solid rgba(255, 255, 255, .78);
  border-radius: 1.4rem;
  background: rgba(255, 253, 248, .96);
  box-shadow: 0 28px 70px rgba(13, 48, 37, .28);
  backdrop-filter: blur(18px);
  animation: story-arrive 420ms cubic-bezier(.2, .8, .2, 1) both;
}

@keyframes story-arrive {
  from { opacity: 0; transform: translateY(1rem) scale(.98); }
}

.match-story > img {
  width: 112px;
  height: 128px;
  border-radius: 1rem;
  object-fit: cover;
}

.story-copy {
  align-self: center;
}

.story-copy > span {
  color: var(--game-clay);
  font-size: .66rem;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.story-copy h3 {
  margin: .25rem 0 .35rem;
  color: var(--game-forest-950);
  font-family: var(--font-family-display);
  font-size: 1.3rem;
  line-height: 1.05;
}

.story-copy p {
  margin: 0;
  color: #52675f;
  font-size: .84rem;
  line-height: 1.42;
}

.story-copy .story-question {
  margin-top: .45rem;
  color: var(--game-forest-850);
  font-family: Georgia, 'Times New Roman', serif;
  font-style: italic;
}

.story-action {
  grid-column: 1 / -1;
  min-height: 44px;
  border: 0;
  border-radius: .85rem;
  color: #fff;
  background: var(--game-forest-850);
  font-weight: 800;
  cursor: pointer;
}

.complete-screen {
  isolation: isolate;
  min-height: calc(100vh - 72px);
  padding: clamp(2rem, 7vw, 6rem) 1rem;
  overflow: hidden;
  background:
    radial-gradient(circle at 15% 15%, rgba(223, 130, 95, .16), transparent 22rem),
    radial-gradient(circle at 88% 12%, rgba(114, 173, 176, .26), transparent 28rem),
    var(--game-cream);
}

.complete-card {
  position: relative;
  z-index: 2;
  display: grid;
  width: min(980px, 100%);
  min-height: 560px;
  margin-inline: auto;
  overflow: hidden;
  border: 1px solid rgba(13, 48, 37, .1);
  border-radius: clamp(1.8rem, 4vw, 3rem);
  background: var(--game-paper);
  box-shadow: var(--game-shadow);
  grid-template-columns: minmax(0, .92fr) minmax(0, 1fr);
  will-change: transform, opacity;
}

.celebration-layer {
  position: absolute;
  z-index: 3;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.reward-particle {
  position: absolute;
  width: var(--particle-size, 12px);
  height: calc(var(--particle-size, 12px) * 1.45);
  top: var(--particle-top, 52%);
  left: var(--particle-left, 50%);
  border-radius: 100% 0 100% 0;
  background: var(--particle-color, var(--game-clay));
  box-shadow: 0 5px 14px rgba(13, 48, 37, .12);
  opacity: 0;
  will-change: transform, opacity;
}

.reward-particle.is-dot {
  height: var(--particle-size, 10px);
  border-radius: 50%;
}

.reward-particle.is-spark {
  height: var(--particle-size, 10px);
  border-radius: 2px;
  transform: rotate(45deg);
}

.complete-image {
  position: relative;
  min-height: 360px;
}

.complete-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.complete-image::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(145deg, transparent 40%, rgba(13, 48, 37, .28));
  content: "";
}

.complete-mark {
  position: absolute;
  z-index: 2;
  display: grid;
  width: 86px;
  height: 86px;
  right: 1.4rem;
  bottom: 1.4rem;
  place-items: center;
  border: 6px solid rgba(255, 255, 255, .86);
  border-radius: 50%;
  color: var(--game-forest-950);
  background: var(--game-gold);
  box-shadow: 0 18px 38px rgba(13, 48, 37, .2);
  font-size: 2.1rem;
  font-weight: 950;
  will-change: transform, opacity;
}

.complete-mark::after {
  position: absolute;
  inset: -7px;
  border: 2px solid rgba(255, 255, 255, .76);
  border-radius: 50%;
  content: "";
  opacity: 0;
}

.complete-screen.is-celebrating .complete-mark::after {
  animation: reward-ring 1.5s cubic-bezier(.2, .75, .2, 1) 250ms both;
}

@keyframes reward-ring {
  0% { opacity: .9; transform: scale(.75); }
  100% { opacity: 0; transform: scale(1.75); }
}

.complete-copy {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  flex-direction: column;
  padding: clamp(2rem, 6vw, 5rem);
}

.complete-copy h2 {
  max-width: 9ch;
}

.complete-copy > p {
  max-width: 44ch;
  margin: .6rem 0 0;
  color: #52675f;
  font-size: 1.08rem;
  line-height: 1.65;
}

.reward-chip {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  align-items: center;
  gap: .55rem;
  margin-top: 1.25rem;
  padding: .62rem .85rem;
  border: 1px solid rgba(35, 107, 84, .18);
  border-radius: 999px;
  color: var(--game-forest-850);
  background: #e8f3ee;
  font-size: .78rem;
  font-weight: 850;
  will-change: transform, opacity;
}

.reward-chip svg {
  width: 19px;
  flex: 0 0 19px;
  fill: var(--game-gold);
  stroke: #876317;
  stroke-width: 1.2;
  stroke-linejoin: round;
}

.complete-screen.is-final-celebration .reward-chip {
  color: #5d4311;
  border-color: rgba(151, 108, 24, .22);
  background: #fff3cf;
}

.complete-screen.is-final-celebration .complete-card {
  box-shadow: 0 36px 110px rgba(13, 48, 37, .24), 0 0 0 1px rgba(233, 188, 99, .28);
}

.game-footer {
  display: flex;
  width: min(1180px, calc(100% - 2rem));
  margin-inline: auto;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.2rem 0 1.8rem;
  color: #667a72;
  font-size: .74rem;
}

.game-footer a {
  color: var(--game-forest-700);
  font-weight: 750;
}

.noscript-message {
  margin: 1rem;
  padding: 1rem;
  border-radius: 1rem;
  color: #fff;
  background: var(--game-forest-950);
}

.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;
}

:where(button, a, input):focus-visible {
  outline: 3px solid color-mix(in srgb, var(--game-clay) 72%, white);
  outline-offset: 4px;
}

@media (max-width: 920px) {
  .welcome-layout {
    grid-template-columns: 1fr;
  }

  .welcome-copy {
    max-width: 760px;
  }

  .welcome-gallery {
    width: min(560px, 94%);
    min-height: 520px;
    margin-inline: auto;
  }

  .gallery-main {
    height: 470px;
  }

  .play-heading {
    display: block;
  }

  .play-stats {
    margin-top: 1rem;
  }

  .chapter-step-label {
    display: none;
  }

  .chapter-step {
    justify-content: center;
    padding: .5rem;
  }

  .complete-card {
    grid-template-columns: 1fr;
  }

  .complete-image {
    max-height: 420px;
  }
}

@media (max-width: 700px) {
  .game-topbar {
    min-height: 64px;
  }

  .game-brand span:last-child {
    display: none;
  }

  .exit-link {
    padding-inline: .75rem;
  }

  .sound-button span {
    display: none;
  }

  .sound-button {
    width: 44px;
    padding: 0;
  }

  .welcome-screen,
  .play-screen,
  .complete-screen {
    min-height: calc(100vh - 64px);
  }

  .welcome-screen {
    padding-top: 2.6rem;
  }

  .welcome-copy h1 {
    font-size: clamp(4.4rem, 23vw, 6.5rem);
  }

  .welcome-gallery {
    min-height: 410px;
  }

  .gallery-main {
    width: 92%;
    height: 375px;
    border-radius: 42% 42% 38% 38% / 28% 28% 50% 50%;
  }

  .gallery-small {
    width: 112px;
    height: 112px;
  }

  .gallery-lake {
    width: 92px;
    height: 92px;
    right: -.5rem;
  }

  .gallery-badge {
    width: 82px;
    height: 82px;
    left: .2rem;
    font-size: .67rem;
  }

  .chapter-progress {
    gap: .35rem;
    margin-bottom: 2rem;
  }

  .chapter-step-number {
    width: 26px;
    height: 26px;
    flex-basis: 26px;
  }

  .play-heading h2 {
    font-size: clamp(2.5rem, 13vw, 4rem);
  }

  .play-stats {
    width: 100%;
  }

  .play-stats div {
    flex: 1;
  }

  .board-stage {
    min-height: 0;
    margin-inline: -.2rem;
    padding: 1rem .75rem 1.2rem;
    border-radius: 1.6rem;
  }

  .board-toolbar {
    align-items: flex-start;
  }

  .board-toolbar > span {
    max-width: 21ch;
  }

  .memory-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .55rem;
  }

  .memory-card {
    border-radius: .85rem;
  }

  .memory-card-face {
    border-radius: .85rem;
  }

  .card-title {
    right: .42rem;
    bottom: .4rem;
    left: .42rem;
    font-size: .61rem;
  }

  .match-story {
    right: .6rem;
    bottom: .6rem;
    width: calc(100% - 1.2rem);
    grid-template-columns: 82px minmax(0, 1fr);
    gap: .75rem;
    border-radius: 1.15rem;
  }

  .match-story > img {
    width: 82px;
    height: 102px;
    border-radius: .8rem;
  }

  .story-copy h3 {
    font-size: 1.08rem;
  }

  .story-copy p {
    font-size: .76rem;
  }

  .complete-card {
    min-height: 0;
  }

  .complete-image {
    min-height: 300px;
  }

  .complete-copy {
    padding: 2rem 1.3rem 2.4rem;
  }

  .complete-copy h2 {
    font-size: 3.2rem;
  }

  .game-footer {
    display: block;
    text-align: center;
  }

  .game-footer span {
    display: block;
    margin-top: .35rem;
  }
}

@media (max-width: 350px) {
  .memory-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .exit-link {
    font-size: .72rem;
  }
}

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

  .memory-card-inner {
    transform-style: flat;
  }

  .reward-particle {
    display: none !important;
  }

  .complete-mark::after {
    animation: none !important;
  }
}
