@font-face {
  font-family: Nunito;
  src: url("./nunito-latin.woff2") format("woff2");
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  /* Wada 263: Slate Color, Turquoise Green, Pinkish Cinnamon, Burnt Sienna. */
  --slate: #34454c;
  --mint: #b5decc;
  --cinnamon: #eeb480;
  --sienna: #ae5224;
  --ink: #293a3c;
  --muted: #536361;
  --ivory: #fff5df;
  --page: #f6efdf;
  --line: #c8bea9;
  --grain: url("./art/paper-grain.svg");
  --type: Nunito, ui-rounded, system-ui, sans-serif;
  font-family: var(--type);
  background: var(--page);
  color: var(--ink);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

body {
  --scene: url("./art/original.svg");
  margin: 0;
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  min-height: 100svh;
  background: var(--grain) var(--page);
}
body[data-background="mint-snow"] { --page: #e3efe4; --scene: url("./art/mint-snow.svg"); }
body[data-background="slate-mist"] { --page: #e0e7e4; --scene: url("./art/slate-mist.svg"); }
body::before {
  content: "";
  position: fixed;
  z-index: -1;
  inset: auto 0 0;
  height: clamp(9rem, min(56vw, 30vh), 20rem);
  pointer-events: none;
  background: var(--scene) center bottom / cover no-repeat;
}
button { font: inherit; touch-action: manipulation; }
button:focus-visible, summary:focus-visible, input:focus-visible {
  outline: 3px solid #86421f;
  outline-offset: 3px;
}
.glyph {
  display: block;
  width: 1.22rem;
  height: 1.22rem;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-linejoin: round;
  stroke-linecap: round;
  pointer-events: none;
}

.game {
  width: min(100%, 33rem);
  margin: auto;
  padding: max(.8rem, env(safe-area-inset-top)) max(.75rem, env(safe-area-inset-right)) max(1.1rem, env(safe-area-inset-bottom)) max(.75rem, env(safe-area-inset-left));
}
.heading { display: flex; align-items: center; gap: .5rem; min-height: 3.8rem; margin: 0 0 .65rem; }
.heading .brand-mark { width: clamp(2.9rem, 12vw, 3.55rem); height: auto; }
.heading-copy { flex: 1; min-width: 0; }
.heading h1 {
  margin: 0;
  font: 900 clamp(1.48rem, 6.9vw, 2.12rem)/1.05 var(--type);
  letter-spacing: -.045em;
}
.board-label { margin: .22rem 0 0; color: var(--muted); font-size: .82rem; line-height: 1.15; font-weight: 750; }
.tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .42rem;
  min-height: 46px;
  min-width: 44px;
  padding: .45rem .7rem;
  border: 1px solid #a99d87;
  border-radius: .72rem;
  background: #fcf5e6;
  box-shadow: 0 2px 0 #bcad94;
  color: var(--ink);
  font-weight: 850;
  font-size: .95rem;
  line-height: 1.1;
  cursor: pointer;
}
.tool:not(:disabled):active { background-color: #ecdfc7; box-shadow: inset 0 1px 2px #54473825; }
.menu-toggle { min-height: 44px; font-size: .84rem; gap: .34rem; padding-inline: .55rem; }
.menu-toggle .glyph { width: 1rem; }
.tool--hint { background-color: #cce3ce; border-color: #859e8b; box-shadow: 0 2px 0 #92a892; }
.tool--primary { background: var(--slate); border-color: #24373d; color: #fff6e3; box-shadow: 0 3px 0 #1f3035; }
.tool--primary:not(:disabled):active { background: #27383d; }
.tool[aria-busy="true"] { border-style: dashed; }
.tool:disabled { color: #6e7066; background: #e9e3d5; border-color: #bcb5a4; box-shadow: 0 2px 0 #c8bfac; cursor: default; }

.play-hud { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 8; }
.score {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(2.7rem, 1fr) auto;
  align-items: baseline;
  column-gap: .45rem;
  min-height: 3.12rem;
  padding: .58rem clamp(.75rem, 4vw, 1.2rem) .85rem;
  border: 1px solid #293b41;
  border-bottom: 0;
  border-radius: 1.1rem 1.1rem 0 0;
  background: var(--grain) #2d4046;
  color: var(--ivory);
  font-variant-numeric: tabular-nums;
}
.score p { margin: 0; white-space: nowrap; }
.live-points { display: flex; align-items: baseline; gap: .4rem; font-size: .9rem; font-weight: 700; }
#live-score { min-width: 4.55ch; color: var(--cinnamon); font-size: 1.48rem; font-weight: 900; line-height: 1.1; letter-spacing: -.025em; }
.pair-count { font-size: .86rem; color: #e5e8db; }
.pair-count strong { color: #fff7e6; font-weight: 850; }
#matched-count { display: inline-block; min-width: 2ch; text-align: right; }
.progress-track {
  position: absolute;
  height: 3px;
  inset: auto clamp(.75rem, 4vw, 1.2rem) 4px;
  border-radius: 5px;
  background: #53666a;
  overflow: hidden;
}
.progress-track span { display: block; width: 0; height: 100%; background: var(--mint); border-radius: inherit; }
.points-slot { position: relative; height: 1rem; align-self: center; pointer-events: none; }
.match-points {
  position: absolute;
  top: 50%; left: 0;
  transform: translateY(-50%);
  display: block;
  padding: .13rem .36rem;
  border-radius: .37rem;
  background: var(--cinnamon);
  color: #3d291f;
  font-size: .79rem;
  font-weight: 900;
  line-height: 1.15;
  white-space: nowrap;
}
.score {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  padding-block: .42rem .63rem;
}
.score .points-slot { display: none; }
.score .pair-count { justify-self: end; font-size: .79rem; }

.table {
  position: relative;
  isolation: isolate;
  border: 1px solid #283b42;
  border-top: 0;
  border-bottom: 3px solid #24353a;
  border-radius: 0 0 1.12rem 1.12rem;
  background: var(--grain) var(--slate);
  color: var(--ivory);
  box-shadow: 0 3px 0 #ad9e85, 0 7px 12px #3f443219;
}
.mat { position: relative; padding: clamp(1.15rem, 5vw, 1.65rem) clamp(.8rem, 3.7vw, 1.3rem) clamp(.95rem, 4vw, 1.3rem); }
.mat::before {
  content: "";
  position: absolute;
  inset: .4rem .38rem .35rem;
  border: 1px solid #64766f;
  border-radius: .38rem .38rem .85rem .85rem;
  pointer-events: none;
}
.mat::after {
  content: "";
  position: absolute;
  bottom: .23rem;
  left: calc(50% - 2.5px);
  width: 5px;
  height: 5px;
  background: #a7b6a4;
  box-shadow: 0 0 0 3px var(--slate);
  transform: rotate(45deg);
  pointer-events: none;
}
.board {
  --columns: 5;
  --rows: 4;
  --column-size: calc(100% / var(--columns));
  --row-size: calc(100% / var(--rows));
  position: relative;
  width: min(100%, 25.5rem);
  aspect-ratio: var(--columns) / calc(var(--rows) * 1.09);
  margin: auto;
}
.tile, .match-ghost {
  display: grid;
  place-items: center;
  padding: 0 0 3px;
  border: 1px solid #b99f78;
  border-bottom: 5px solid #c1a47b;
  border-radius: clamp(.45rem, 2vw, .65rem);
  background: var(--grain) var(--ivory);
  box-shadow: inset 0 0 0 1.6px #fffbed, inset 0 -2px #ecdcbb, 0 2px 1px #16282b8c;
}
.tile {
  --depth-x: -4px;
  --depth-y: -5px;
  position: absolute;
  z-index: calc(3 * var(--z));
  top: calc(var(--row-size) * var(--y) + var(--depth-y) * var(--z));
  left: calc(var(--column-size) * var(--x) + var(--depth-x) * var(--z) + 2px);
  width: calc(var(--column-size) - 4px);
  height: calc(var(--row-size) - 4px);
  scroll-margin-block: 4rem 4.3rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.tile:not([data-z="0"]) { box-shadow: inset 0 0 0 1.6px #fffbed, inset 0 -2px #ecdcbb, 2px 4px 3px #16272cbb; }
.motif { display: block; width: 78%; height: 83%; max-width: 3.45rem; pointer-events: none; }
.tile[aria-disabled="true"] {
  border-color: #9a9e8c;
  border-bottom-color: #909785;
  background-color: #c2c6b4;
  box-shadow: inset 0 0 0 1.4px #d5d6bf, 0 2px 1px #203231;
  cursor: default;
}
.tile[aria-disabled="true"] .motif { opacity: .76; filter: saturate(.55); }
.tile[aria-pressed="true"] {
  border-color: #99532d;
  border-bottom-color: #98623c;
  background-color: #ffddb1;
  box-shadow: inset 0 0 0 2.8px #a9532b, inset 0 0 0 4.5px #fff0cf, 0 3px 2px #192c2f99;
}
.tile[data-hinted="true"][aria-pressed="false"] { background-color: #d9efdb; border-color: #52746a; border-bottom-color: #829f88; }
.tile[data-hinted="true"][aria-pressed="false"]::after {
  content: "";
  position: absolute;
  inset: 2px;
  border: 1.6px dashed #39675b;
  border-radius: .36rem;
  pointer-events: none;
}
.tile:focus-visible {
  z-index: calc(3 * var(--z) + 1);
  outline: 3px solid #fff7df;
  outline-offset: 1.5px;
}
.tile:focus-visible::before {
  content: "";
  position: absolute;
  inset: -2px;
  border: 2px solid #23363c;
  border-radius: inherit;
  pointer-events: none;
}
.corner {
  display: none;
  position: absolute;
  z-index: 1;
  right: 2px;
  bottom: 1px;
  width: .88rem;
  height: .88rem;
  padding: 1px;
  border-radius: 50%;
}
.tile[aria-disabled="true"] .lock { display: block; width: .65rem; height: .65rem; padding: 0; color: #4c5a54; }
.tile[aria-pressed="true"] .check { display: block; background: #93471f; color: #fff4dc; }
.tile[data-hinted="true"][aria-pressed="false"] .spark { display: block; background: #386456; color: #e7f6dd; }

.tools {
  position: sticky;
  z-index: 6;
  bottom: env(safe-area-inset-bottom, 0px);
  display: grid;
  grid-template-columns: .9fr .9fr 1.18fr 1.05fr;
  gap: .48rem;
  margin: 0 -.12rem;
  padding: .75rem .12rem .48rem;
  background: var(--grain) var(--page);
  border-radius: 0 0 .75rem .75rem;
}
.tools .tool { white-space: nowrap; }
.recovery-note {
  grid-column: 1 / -1;
  margin: 0;
  color: #784227;
  font: 850 .87rem/1.2 var(--type);
}
.guide {
  display: grid;
  grid-template-columns: clamp(3.8rem, 17vw, 4.45rem) minmax(0, 1fr);
  gap: .62rem;
  align-items: start;
  margin: .45rem .1rem 0;
  padding: .68rem .2rem .42rem;
  border-top: 1px solid #a9b1a0;
  background: var(--grain) var(--page);
  border-radius: 0 0 .7rem .7rem;
}
.portrait { display: block; }
.plush { display: block; width: 100%; height: auto; overflow: visible; }
.guide-peppy { align-self: start; position: relative; }
.guide-peppy::before, .victory-scene::before {
  content: "";
  position: absolute;
  z-index: -1;
  left: 15%; right: 15%; bottom: 0;
  height: 12%;
  border-radius: 50%;
  background: #9eac9560;
}
.guide-peppy, .victory-scene { isolation: isolate; }
.guide-byline { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 .5rem; min-height: 1.45rem; }
.guide-title { margin: 0; color: #384c46; font: 900 1.02rem/1.3 var(--type); }
.milestone-note { color: #814325; font: italic 800 .86rem/1.25 var(--type); white-space: nowrap; }
.status {
  margin: .12rem 0 0;
  min-block-size: 3.85em;
  color: #344746;
  font: 650 .92rem/1.28 var(--type);
  overflow-wrap: break-word;
}
.game .status { min-block-size: 2.55em; }
.stage-tip {
  display: flex;
  align-items: center;
  gap: .35rem;
  margin-top: .3rem;
  padding: .15rem .2rem .15rem .5rem;
  border: 1px solid #acb8a6;
  border-radius: .55rem;
  background: #e9ede0;
}
.stage-tip p { flex: 1; margin: 0; font-size: .85rem; font-weight: 800; line-height: 1.28; }
.tip-dismiss { min-height: 44px; padding: 0; box-shadow: none; font-size: 1.15rem; }
.save-note { color: #813918; font-size: .9rem; }

.match-feedback { position: fixed; z-index: 5; inset: 0; overflow: hidden; pointer-events: none; }
.match-ghost { position: absolute; background-color: #ffe1b8; border-color: #ad7850; box-shadow: inset 0 0 0 2px #efb477, 0 2px 2px #2c393055; }
.match-spark { position: absolute; top: 3px; left: 3px; width: .97rem; height: .97rem; color: #365d60; }
.match-points--near { z-index: 1; transform: translate(-50%, -50%); }
.result {
  position: relative;
  max-width: 23rem;
  margin: 0 auto;
  padding: .95rem clamp(.7rem, 3.3vw, 1.2rem) .85rem;
  border: 1px solid #b7a586;
  border-radius: .9rem;
  background: var(--grain) #fbf1d9;
  color: var(--ink);
  text-align: center;
  box-shadow: inset 0 0 0 3px #fff7e7, inset 0 0 0 4px #d3c5a3, 0 3px 1px #1d3035;
}
.result:focus-visible { outline: 3px solid var(--mint); }
.result h2 { margin: 0; font: 900 clamp(1.65rem, 7vw, 2.1rem)/1.08 var(--type); letter-spacing: -.04em; }
.victory-scene {
  position: relative; display: flex; justify-content: center; align-items: end; gap: .1rem;
  width: max-content; max-width: 100%; margin: .2rem auto .6rem;
}
.victory-scene::before { left: 24%; right: 24%; bottom: -1%; height: 9%; }
.victory-peppy { width: clamp(5.8rem, min(32vw, 16vh), 9.2rem); }
.bough { width: clamp(1.8rem, 8vw, 3rem); height: auto; margin-bottom: .65rem; }
.bough:last-child { transform: scaleX(-1); }
.next-board { width: min(100%, 15.5rem); font-size: 1.05rem; }
.result-actions { display: flex; justify-content: center; gap: .45rem; }
.game .result-actions .next-board { width: min(100%, 11rem); }
.result-totals {
  display: flex; justify-content: center; gap: .3rem; margin: 1rem 0 .42rem;
  padding: .6rem 0 0; border-top: 1px solid #c6baa2;
}
.result-totals div { flex: 1; }
.result-totals div + div { border-left: 1px solid #c6baa2; }
.result-totals dt, .result-breakdown { font-size: .78rem; font-weight: 700; color: #52615a; }
.result-totals dd { margin: 0; font-weight: 900; font-size: 1.45rem; line-height: 1.15; font-variant-numeric: tabular-nums; }
.result-awards { margin: .58rem 0 .12rem; font-size: .85rem; font-weight: 700; }
.result-awards strong { color: #84441f; }
.result-breakdown { margin: 0; }
.result-awards > span, .result-breakdown > span[aria-hidden] { margin-inline: .25rem; }
.quick-clear {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  margin: .35rem 0 .1rem;
  padding: .22rem .52rem;
  border: 1px solid #7b9b87;
  border-radius: .42rem;
  background: #dcebe0;
  color: #335649;
  font-size: .85rem;
  font-weight: 900;
}
.quick-clear .glyph { width: .9rem; height: .9rem; }

.confirm {
  width: min(26rem, calc(100% - 1.4rem));
  max-height: calc(100% - max(.7rem, env(safe-area-inset-top)) - max(.7rem, env(safe-area-inset-bottom)));
  overflow: auto;
  overscroll-behavior: contain;
  padding: 1.05rem;
  border: 1px solid #9c967f;
  border-radius: 1rem;
  color: var(--ink);
  background: var(--grain) #f8f0df;
  box-shadow: 0 5px 0 #877d6a, 0 12px 40px #19282b55;
}
.confirm::backdrop { background: #26393dd1; }
.confirm h2 { margin: 0; font-size: 1.6rem; font-weight: 900; line-height: 1.13; letter-spacing: -.035em; }
.confirm p { line-height: 1.35; }
.confirm p:empty { display: none; }
.menu-actions { display: grid; grid-template-columns: .9fr 1.2fr; gap: .55rem; margin: .9rem 0 1rem; }
.sound-state { padding: .15rem .35rem; border-radius: .32rem; font-size: .78rem; background: #dedacc; }
[aria-pressed="true"] .sound-state { background: #c3dccc; }
.scrapbook { border-block: 1px solid #bdb59e; }
.scrapbook summary {
  display: flex; align-items: center; gap: .48rem; min-height: 48px;
  cursor: pointer; list-style: none; font-size: 1.04rem; font-weight: 850;
}
.scrapbook summary::-webkit-details-marker { display: none; }
.scrapbook summary::after {
  content: ""; width: .5rem; height: .5rem; margin-left: auto; margin-right: .35rem;
  border: solid var(--muted); border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.scrapbook[open] summary::after { transform: rotate(225deg); }
.scrapbook-stats { font-size: .86rem; margin: 0 0 .8rem; }
.scrapbook-stats div { display: flex; justify-content: space-between; gap: .4rem; padding: .15rem .1rem; }
.scrapbook-stats dd { margin: 0; font-weight: 850; font-variant-numeric: tabular-nums; }
.board-sizes { min-inline-size: 0; margin: .7rem 0 .85rem; border: 0; padding: 0; }
.board-sizes legend { padding: 0 0 .35rem; font-weight: 800; font-size: .92rem; }
.board-size, .theme-option {
  display: flex; align-items: center; gap: .62rem; min-height: 46px; padding: .45rem .6rem;
  border: 1px solid #c2b9a4; border-radius: .6rem; background: #fff8e9; cursor: pointer;
}
.board-size + .board-size, .theme-option + .theme-option { margin-top: .36rem; }
.board-size input, .theme-option input { flex: none; width: 17px; height: 17px; margin: 0; accent-color: #3e6559; }
.board-size span, .theme-copy { display: grid; }
.board-size small, .theme-copy small, .offline-status { color: var(--muted); font-size: .81rem; }
.theme-option { gap: .56rem; padding: .32rem .48rem; }
.theme-option:has(input:checked) { border-color: #5a7968; box-shadow: inset 0 0 0 1px #5a7968; }
.theme-option:has(input:disabled) { cursor: default; }
.theme-copy strong { font-size: .93rem; }
.theme-preview {
  flex: none; width: clamp(3.65rem, 19vw, 5.1rem); height: 2.55rem;
  border: 1px solid #a9ab96; border-radius: .33rem; background-position: center bottom; background-size: cover;
}
.preview-original { background-color: #f4ecda; background-image: url("./art/original.svg"); }
.preview-mint { background-color: #dfeddf; background-image: url("./art/mint-snow.svg"); }
.preview-slate { background-color: #d9e3e0; background-image: url("./art/slate-mist.svg"); }
.finale-story-note { margin: .55rem 0 0; color: var(--muted); font-size: .85rem; }
.story-gallery { margin-block: .6rem .8rem; border-top: 1px solid var(--line); }
.story-gallery > summary { min-height: 44px; font-size: .94rem; }
.story-gallery h3 { margin: .55rem 0 .28rem; font-size: .87rem; }
.story-gallery ul { display: grid; gap: .35rem; list-style: none; padding: 0; margin: 0 0 .72rem; }
.story-card, .story-lock {
  width: 100%;
  min-height: 44px;
  justify-content: start;
  gap: .62rem;
  text-align: left;
  font-size: .89rem;
}
.story-card, .story-control, #play-again { -webkit-tap-highlight-color: transparent; }
.story-lock { display: flex; align-items: center; padding-inline: .65rem; color: var(--muted); }
.story-cover { width: 42px; height: 74.67px; object-fit: contain; flex: none; border-radius: .2rem; background: #d6e3d8; }
.story-player {
  --story-sky: #42666d;
  --story-snow: #c8dcd5;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
  color: var(--ivory);
  background: linear-gradient(var(--story-sky), var(--story-snow));
}
.story-player[data-chapter="harbour"] { --story-sky: #386274; --story-snow: #c4dcda; }
.story-player[data-chapter="games"] { --story-sky: #4b7179; --story-snow: #dae3ce; }
.story-player[data-chapter="coast"] { --story-sky: #515c78; --story-snow: #c9cbdb; }
.story-player[data-chapter="lights"] { --story-sky: #263e58; --story-snow: #b3becb; }
.story-player[data-chapter="summit"] { --story-sky: #172d44; --story-snow: #929eaf; }
.story-layout {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: .45rem;
  width: min(100%, 38rem);
  height: 100%;
  margin-inline: auto;
  padding: max(.65rem, env(safe-area-inset-top)) max(.65rem, env(safe-area-inset-right))
    max(.65rem, env(safe-area-inset-bottom)) max(.65rem, env(safe-area-inset-left));
}
.story-header { text-align: center; }
.story-chapter-label { margin: 0 0 .16rem; font-weight: 850; font-size: .72rem; letter-spacing: .11em; text-transform: uppercase; }
.story-header h2 { margin: 0; font: 600 clamp(1.15rem, 5vw, 1.6rem)/1.16 Georgia, serif; }
.story-stage { display: grid; place-items: center; position: relative; min-height: 0; }
.story-pictures, .story-image { position: absolute; inset: 0; width: 100%; height: 100%; }
.story-image { display: block; object-fit: contain; }
.story-summary {
  z-index: 1;
  max-width: min(24rem, 100%);
  margin: 0;
  padding: 1rem 1.15rem;
  border: 1px solid var(--line);
  border-radius: .75rem;
  background: var(--ivory);
  color: var(--ink);
  line-height: 1.42;
  text-align: center;
}
.story-controls { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: .35rem; }
.story-control { min-width: 64px; justify-self: start; color: var(--ink); background: #fff5df; }
.story-control--next { grid-column: 3; justify-self: end; }
.story-panel-count { grid-column: 2; min-width: 3ch; text-align: center; color: #253e46; font-weight: 850; font-variant-numeric: tabular-nums; }
.story-player :focus-visible { outline-color: #6d4225; }
@media (prefers-reduced-motion: no-preference) {
  .story-image--dissolve { animation: story-picture-in 140ms ease-out both; }
  @keyframes story-picture-in { from { opacity: 0; } to { opacity: 1; } }
}
.confirm-actions { display: flex; justify-content: end; gap: .5rem; }
.offline-status { margin: .75rem 0; }
.mode-actions { display: grid; gap: .62rem; margin-block: .9rem; }
.mode-resume { flex-direction: column; align-items: start; gap: .16rem; text-align: left; }
.mode-resume small, .stage-select small { font-size: .77rem; font-weight: 750; }
.mode-resume small { opacity: .88; }
.stage-list { display: grid; gap: .32rem; margin: 0 0 .65rem; padding: 0; list-style: none; }
.stage-select { width: 100%; justify-content: space-between; text-align: left; font-size: .89rem; }
.stage-select small { flex: none; }
.endless-actions { display: grid; grid-template-columns: 1.15fr 1fr; gap: .5rem; }
@media (min-width: 520px) {
  .game { padding-top: max(1.2rem, env(safe-area-inset-top)); }
}
@media (max-width: 350px) {
  .game { padding-left: max(.48rem, env(safe-area-inset-left)); padding-right: max(.48rem, env(safe-area-inset-right)); }
  .heading { gap: .3rem; }
  .menu-toggle { padding-inline: .43rem; }
  .tools { gap: .36rem; }
  .tools .tool { padding-inline: .23rem; gap: .22rem; font-size: .85rem; }
  .tools .glyph { width: .92rem; height: .92rem; }
  .score { column-gap: .32rem; }
  #live-score { font-size: 1.34rem; }
  .pair-count { font-size: .81rem; }
  .guide { gap: .43rem; }
}
@media (max-height: 630px) and (orientation: portrait) {
  .game { padding-top: max(.3rem, env(safe-area-inset-top)); }
  .heading { min-height: 2.95rem; margin-bottom: .32rem; }
  .score { min-height: 2.7rem; padding-block: .34rem .63rem; }
  .mat { padding-block: .87rem .65rem; }
  .game[data-layout="large"] .board,
  .game[data-mode="ice-cove"] .board { max-height: max(19.4rem, calc(100svh - 15.4rem)); }
  .tools { padding-block: .5rem .27rem; }
  .guide { grid-template-columns: 2.9rem minmax(0, 1fr); padding-block: .24rem .16rem; margin-top: .18rem; }
  .guide-byline { min-height: 1.12rem; }
  .guide-title { font-size: .94rem; }
  .status { font-size: .88rem; }
}
@media (prefers-reduced-motion: no-preference) {
  .match-ghost { animation: match-pop 220ms cubic-bezier(.2,.75,.25,1) both; }
  .match-points { animation: earned-points 1050ms ease-out both; }
  .match-points--near { animation: near-points 1050ms ease-out both; }
  .result--celebrate .victory-peppy { animation: peppy-hop 620ms ease-in-out; }
  .guide[data-emote="25"] .plush { animation: peppy-nod 560ms ease-in-out; }
  .guide[data-emote="50"] .flipper-right { animation: peppy-wave 690ms ease-in-out; }
  .guide[data-emote="75"] .flipper-left { animation: left-cheer 620ms ease-in-out; }
  .guide[data-emote="75"] .flipper-right { animation: right-cheer 620ms ease-in-out; }
  @keyframes match-pop { 0% { opacity: 1; transform: scale(1); } 31% { opacity: 1; transform: scale(1.055); } 100% { opacity: 0; transform: scale(.96); } }
  @keyframes earned-points { 0% { transform: translateY(-28%); } 18%, 79% { opacity: 1; transform: translateY(-50%); } 100% { opacity: 0; transform: translateY(-68%); } }
  @keyframes near-points { 0%, 85% { opacity: 1; } 100% { opacity: 0; } }
  @keyframes peppy-hop { 0%, 100% { transform: none; } 37% { transform: translateY(-.5rem) rotate(-5deg); } 70% { transform: translateY(-.12rem) rotate(3deg); } }
  @keyframes peppy-nod { 0%, 100% { transform: none; } 36% { transform: translateY(2px) rotate(6deg); } 75% { transform: rotate(-3deg); } }
  @keyframes peppy-wave { 0%, 100% { transform: rotate(0); } 23%, 68% { transform: rotate(-53deg); } 45%, 84% { transform: rotate(-20deg); } }
  @keyframes left-cheer { 0%, 100% { transform: none; } 40% { transform: rotate(34deg); } }
  @keyframes right-cheer { 0%, 100% { transform: none; } 40% { transform: rotate(-34deg); } }
}
.flipper-left, .flipper-right { transform-box: view-box; }
.flipper-left { transform-origin: 35% 54%; }
.flipper-right { transform-origin: 68% 54%; }
@media (prefers-reduced-motion: reduce) {
  .guide[data-emote="25"] .plush { transform: rotate(4deg); }
  .guide[data-emote="50"] .flipper-right { transform: rotate(-40deg); }
  .guide[data-emote="75"] .flipper-left { transform: rotate(27deg); }
  .guide[data-emote="75"] .flipper-right { transform: rotate(-27deg); }
}
@media (hover: hover) {
  .tool:not(:disabled):hover { border-color: #586d60; }
  .tile[aria-disabled="false"]:hover { border-top-color: #7d705a; }
}


/* Ice Cove: rewarding matches without sacrificing the tabletop's readability. */
.game { --frost-bright: #ddf7ef; --reward-ink: #502b19; }
.game .score {
  background: var(--grain), linear-gradient(125deg, #263e46, var(--slate) 65%, #396562);
}
.game .table {
  background: var(--grain), radial-gradient(ellipse at 50% 9%, #516c70, transparent 72%), var(--slate);
}
.game .progress-track {
  height: 4px;
  background: #587071;
}
.game .progress-track span {
  background: linear-gradient(90deg, #77b2aa, var(--frost-bright));
}
.game #live-score {
  color: #ffd5a4;
  text-shadow: 0 1px 0 #241d1a;
}

.tile:is([data-special="cracked-ice"], :has(.motif--cracked-ice)) .motif {
  width: 93%;
  height: 92%;
  filter: drop-shadow(0 0 2px #a8e4e1);
}
.tile:is([data-special="cracked-ice"], :has(.motif--cracked-ice))[aria-pressed="false"][data-hinted="false"] {
  border-color: #a0dedc;
  border-bottom-color: #397384;
  background: linear-gradient(150deg, #effffa 10%, #b0e2e2 62%, #8bc3cb);
  box-shadow: inset 0 0 0 1.5px #effff9, inset 0 -3px 0 #61a6ae, 0 2px 4px #1a3f4db3;
}
.tile:is([data-special="cracked-ice"], :has(.motif--cracked-ice))[aria-disabled="true"][data-hinted="false"] {
  border-color: #84a8a5;
  border-bottom-color: #4a8185;
  background: linear-gradient(150deg, #c6ddcf, #81abad);
  box-shadow: inset 0 0 0 1px #e4ebe477, 0 2px 1px #203231;
}
.tile:is([data-special="cracked-ice"], :has(.motif--cracked-ice))[aria-pressed="false"][data-hinted="false"]::after {
  content: "✦";
  position: absolute;
  left: 2px;
  top: 1px;
  padding: 0 2px;
  border-radius: .22rem;
  color: #eafff6;
  background: #326268;
  font: 850 .62rem/1 var(--type);
  pointer-events: none;
}
.match-points--near {
  padding: .24rem .44rem;
  border: 1px solid #ffedca;
  border-radius: 1rem;
  background: linear-gradient(180deg, #ffdfb1, var(--cinnamon));
  color: var(--reward-ink);
  box-shadow: 0 2px 0 #7a442c, 0 4px 9px #17323971;
  font-size: .87rem;
}
.match-points--combo {
  border: 2px solid #fff6d6;
  background: linear-gradient(145deg, #fff0ad, #ffd098 55%, #efae73);
  font-size: .94rem;
  text-shadow: 0 1px #fff1d0;
}
.match-points--quake {
  border-color: #eafffb;
  background: linear-gradient(145deg, #f1fff3, #90d4d4);
  color: #1d4c58;
}

.game .result {
  isolation: isolate;
  border-color: #bee4d3;
  background: var(--grain), radial-gradient(ellipse at 50% 21%, #fff5ce, transparent 46%), linear-gradient(156deg, #f7fbeb, #d3eae1 69%, #c0ddd4);
  box-shadow: inset 0 0 0 3px #f6fff2, inset 0 0 0 4px #8dbbb1, 0 3px 0 #19363b, 0 8px 20px #1d383b72;
}
.game .result h2 {
  color: #21454c;
  text-shadow: 0 1px #fffcef;
}
.game .victory-scene::after {
  content: "✦  ·  ✶  ·  ✦";
  position: absolute;
  z-index: -1;
  inset: 1% -10% auto;
  color: #397476;
  font: 900 clamp(1.08rem, 5.5vw, 1.7rem)/1 var(--type);
  letter-spacing: .34em;
  white-space: nowrap;
  pointer-events: none;
}
.game .result-actions .next-board {
  min-height: 48px;
  border-color: #23494f;
  background: linear-gradient(180deg, #4f777a, #2c5058);
  box-shadow: inset 0 1px 0 #e7fbda55, 0 3px 0 #1d373e;
}
.game .result-actions .next-board:active {
  background: #2c4d56;
  box-shadow: inset 0 2px 3px #19353f;
}
.game .result-totals,
.game .result-totals div + div { border-color: #95b8ad; }
.game #result-total dd { color: #194e59; }

@media (prefers-reduced-motion: no-preference) {
  .match-points--near { animation: peppy-points-rise 1050ms cubic-bezier(.19,.72,.23,1) both; }
  .match-points--combo { animation: peppy-combo-rise 1050ms cubic-bezier(.19,.72,.23,1) both; }
  .game .result--celebrate .victory-scene::after {
    animation: peppy-win-glint 580ms ease-out both;
  }
  @keyframes peppy-points-rise {
    0% { transform: translate(-50%, -42%) scale(.92); opacity: .55; }
    22%, 82% { opacity: 1; }
    100% { transform: translate(-50%, calc(-50% - 10px)); opacity: 0; }
  }
  @keyframes peppy-combo-rise {
    0% { transform: translate(-50%, -26%) scale(.78); opacity: 0; }
    22% { transform: translate(-50%, -52%) scale(1.10); opacity: 1; }
    46%, 84% { opacity: 1; }
    100% { transform: translate(-50%, calc(-50% - 13px)) scale(1.02); opacity: 0; }
  }
  @keyframes peppy-win-glint {
    0% { opacity: 0; transform: translateY(.45rem) scale(.84); }
    57% { opacity: 1; transform: translateY(-.25rem) scale(1.08); }
    100% { transform: none; }
  }
}



.combo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: start;
  align-self: center;
  max-width: 100%;
  padding: .22rem .38rem .18rem;
  border: 1px solid #ffe5ad;
  border-radius: .6rem;
  background: linear-gradient(165deg, #ffebb2, var(--cinnamon));
  color: #502b19;
  box-shadow: 0 1px 0 #8f5a3f;
  font: 900 .76rem/1.1 var(--type);
  white-space: nowrap;
}
.power-callout {
  position: absolute;
  z-index: 2;
  top: .05rem;
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - .75rem);
  padding: .3rem .72rem;
  border: 1px solid #c8f4e2;
  border-radius: 1rem;
  background: linear-gradient(175deg, #effff0, #b1e3d5);
  color: #254f52;
  box-shadow: 0 2px 0 #2b6166, 0 5px 10px #162e3755;
  font: 900 .9rem/1.2 var(--type);
  text-align: center;
  pointer-events: none;
}
.power-callout[data-kind="combo"] {
  border-color: #ffeec4;
  background: linear-gradient(180deg, #ffecb2, #f4bd82);
  color: #512d1d;
  box-shadow: 0 2px #8f5633, 0 5px 10px #162e3755;
}
.power-callout[data-kind="quake"] {
  border-color: #defffb;
  background: linear-gradient(180deg, #e9fff7, #89cbd1);
}
.level-earned dd { color: #20545b; }
@media (max-width: 350px) {
  .combo-badge { padding-inline: .27rem; font-size: .7rem; }
}
@media (prefers-reduced-motion: no-preference) {
  .power-callout { animation: peppy-callout 1.4s cubic-bezier(.2,.7,.28,1) both; }
  @keyframes peppy-callout {
    0% { opacity: 0; transform: translate(-50%, -.32rem) scale(.88); }
    18% { opacity: 1; transform: translate(-50%, .12rem) scale(1.03); }
    32%, 87% { opacity: 1; transform: translateX(-50%); }
    100% { opacity: 0; transform: translate(-50%, -.15rem); }
  }
}

.score .live-points { gap: .32rem; min-width: 0; }
.score .combo-badge { flex: none; }
.score #live-score { min-width: 0; }
@media (max-width: 410px) {
  .score .live-points {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    align-items: center;
    justify-items: start;
    gap: 0 .24rem;
    font-size: .74rem;
    line-height: 1;
  }
  .score #live-score { grid-row: 2; grid-column: 1; }
  .score .combo-badge { grid-row: 2; grid-column: 2; }
  .result-totals { margin-top: .8rem; }
  .result-totals dd { font-size: clamp(1.08rem, 4.6vw, 1.35rem); }
}
@media (prefers-reduced-motion: no-preference) {
}


/* Arcade cabinet: ice-cut jewel tones, warm bulbs and an LED-like score well. */
.game {
  --cabinet-deep: #18363e;
  --cabinet-ice: #dff6ee;
  --cabinet-patina: #6ab9b2;
  --cabinet-glint: #fff0c2;
}
.heading .brand-mark {
  filter: drop-shadow(0 2px 0 #603a273d) drop-shadow(0 0 7px #eeb48063);
}
.reward-marquee {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  min-height: 1.72rem;
  padding: .16rem clamp(2.6rem, 13vw, 4.65rem) .19rem;
  border: 1px solid #876044;
  border-bottom: 0;
  border-radius: .95rem .95rem 0 0;
  background: linear-gradient(177deg, #fff0c2, var(--cinnamon) 52%, #ba7653);
  box-shadow: inset 0 1px 0 #fff6d0, inset 0 -2px 0 #814b394d, 0 2px 7px #214a5066;
  color: #402a21;
  font: 900 clamp(.62rem, 3vw, .83rem)/1 var(--type);
  letter-spacing: .15em;
  text-align: center;
  text-shadow: 0 1px #ffedc1a1;
  text-transform: uppercase;
}
.reward-marquee::before,
.reward-marquee::after {
  content: "";
  position: absolute;
  z-index: -1;
  top: calc(50% - 4px);
  width: clamp(1.8rem, 9vw, 4rem);
  height: 8px;
  background: radial-gradient(circle, #fff6ca 24%, #f5cf79 38%, #b97550 48%, transparent 56%) left center / 11px 8px repeat-x;
  opacity: .85;
  pointer-events: none;
}
.reward-marquee::before { left: .45rem; }
.reward-marquee::after { right: .45rem; background-position: right center; }
.reward-marquee + .score {
  border-top: 1px solid #f5dca1;
  border-radius: 0;
}
.game .score {
  padding-block: .34rem .64rem;
  background: var(--grain), radial-gradient(ellipse at 25% 0%, #537b80, transparent 74%), linear-gradient(150deg, #31515a, #1e3f47);
  box-shadow: inset 0 1px 0 #9dc2bf49;
}
.game #live-score {
  min-width: 5.1ch;
  margin: 0;
  padding: .1rem .34rem .07rem;
  border: 1px solid #719393;
  border-radius: .36rem;
  background: linear-gradient(180deg, #0e2930, #264653 47%, #132c35 50%, #1b3b44);
  box-shadow: inset 0 1px 2px #10282b, 0 1px 0 #a3bab730;
  color: #ffdc95;
  font-size: clamp(1.25rem, 5.7vw, 1.75rem);
  line-height: 1.05;
  letter-spacing: .045em;
  text-align: center;
  text-shadow: 0 0 7px #ffbd5d60, 0 1px #582a1d;
}
.score[data-scoring="true"] #live-score {
  border-color: #eddb9f;
  color: #ffedbe;
  box-shadow: inset 0 0 7px #eeb48028, 0 0 6px #ffcf746e;
}
.game .score .live-points { color: #f6edd5; font-weight: 900; }
.game .table {
  border-color: #75928c;
  border-bottom-color: #24464b;
  background: var(--grain), radial-gradient(ellipse at 50% 0%, #5d8889, transparent 75%), linear-gradient(#385e65, #2b4950);
}
.game .mat { isolation: isolate; }
.game .mat::before {
  background: #d4ede5;
  box-shadow: 0 0 0 3px #417079;
}
.game .tile:is([data-special="cracked-ice"], :has(.motif--cracked-ice))[aria-disabled="false"][aria-pressed="false"][data-hinted="false"] {
  border-color: #e8fff4;
  border-bottom-color: #5599a4;
  background: repeating-linear-gradient(130deg, #fff7 0 3px, transparent 3px 14px), radial-gradient(ellipse at 38% 22%, #f4fff5, #a9e4e0 59%, #7cbac5);
  box-shadow: inset 0 0 0 2px #effff7, inset 0 -3px #75b7bd, 0 0 8px #8cdece6b;
}
.power-callout {
  top: .08rem;
  z-index: 4;
  padding: .25rem .78rem;
  font-weight: 900;
  letter-spacing: .035em;
}
.power-callout[data-kind="quake"] {
  background: linear-gradient(155deg, #fbffdf, #ace0da 58%, #74bcc5);
  color: #153c49;
  border-color: #eefff1;
  box-shadow: 0 0 0 1px #427989, 0 3px 0 #24555e, 0 0 16px #b8f0e3c4;
}
.game .result {
  background: var(--grain), radial-gradient(ellipse at 50% 19%, #fff6bb 1%, #fff1cc 23%, transparent 47%), linear-gradient(153deg, #f1f9e7, #bbddd4);
  border: 2px solid #a47c4f;
  box-shadow: inset 0 0 0 3px #ffe6ac, inset 0 0 0 5px #d3a56b, 0 0 0 2px #fff3bb, 0 6px 13px #1a333e8c;
}
.game .result h2 { padding: .22rem .25rem 0; }
.game .victory-scene::after { color: #9b663e; text-shadow: 0 0 6px #fff1ab; }
.game .result-actions .next-board {
  color: #35251c;
  border-color: #86543f;
  background: linear-gradient(#ffefb8 3%, #f0ba80 55%, #e1a474);
  box-shadow: inset 0 1px 0 #fff7d2, 0 3px 0 #81573f, 0 5px 10px #81583556;
  text-shadow: 0 1px #ffefc9;
}
.game .result-actions .next-board:active {
  background: linear-gradient(#f4c992, #e4a874);
  box-shadow: inset 0 2px 4px #80573f60;
}
.game .result #result-total dd { color: #204852; font-weight: 900; }

@media (max-width: 350px) {
  .reward-marquee { min-height: 1.54rem; padding-inline: 2.35rem; }
  .game #live-score { min-width: 4.45ch; letter-spacing: .025em; }
}
@media (max-height: 630px) and (orientation: portrait) {
  .reward-marquee { min-height: 1.48rem; }
  .game .score { padding-block: .26rem .54rem; }
}
@media (prefers-reduced-motion: no-preference) {
  .reward-marquee:has(+ .score[data-scoring="true"])::before { animation: bulb-glint 390ms ease-out; }
  .reward-marquee:has(+ .score[data-scoring="true"])::after { animation: bulb-glint 390ms 70ms ease-out; }
  .score[data-scoring="true"] #live-score { animation: tally-lift 340ms cubic-bezier(.22,.6,.2,1) both; }
  .game .result--celebrate { animation: reward-land 430ms cubic-bezier(.21,.61,.27,1) both; }
  @keyframes bulb-glint {
    0%, 100% { opacity: .85; }
    22% { opacity: 1; filter: brightness(1.36) drop-shadow(0 0 3px #fff7be); }
    55% { opacity: .68; }
  }
  @keyframes tally-lift {
    0% { transform: translateY(1px) scaleY(.92); }
    38% { transform: translateY(-1px) scaleY(1.07); }
    100% { transform: none; }
  }
  @keyframes reward-land {
    0% { opacity: .3; transform: translateY(6px) scale(.98); }
    63% { opacity: 1; transform: translateY(-1px) scale(1.01); }
    100% { opacity: 1; transform: none; }
  }
}


.reward-marquee {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(.24rem, 1.8vw, .65rem);
  min-height: 1.85rem;
  padding: .08rem .42rem .12rem;
}
.reward-marquee::before, .reward-marquee::after { content: none; }
.marquee-lights {
  flex: 1;
  min-width: 1.2rem;
  max-width: 5rem;
  height: 8px;
  background: radial-gradient(circle, #fff6ca 24%, #f5cf79 38%, #b97550 48%, transparent 56%) left center / 11px 8px repeat-x;
  opacity: .89;
}
.marquee-lights:last-of-type { background-position: right center; }
.marquee-peppy { width: 1.62rem; flex: none; }
.marquee-copy { display: inline-flex; align-items: baseline; gap: .42rem; white-space: nowrap; }
.marquee-copy strong { font-size: clamp(.72rem, 3.1vw, .96rem); }
.marquee-copy small { font-size: clamp(.58rem, 2.55vw, .7rem); color: #593723; letter-spacing: .09em; }
@media (max-width: 350px) {
  .reward-marquee { padding-inline: .28rem; gap: .25rem; min-height: 1.7rem; }
  .marquee-copy { gap: .31rem; }
  .marquee-peppy { width: 1.35rem; }
}
@media (prefers-reduced-motion: no-preference) {
  .reward-marquee:has(+ .score[data-scoring="true"]) .marquee-lights:first-child { animation: bulb-glint 390ms ease-out; }
  .reward-marquee:has(+ .score[data-scoring="true"]) .marquee-lights:last-of-type { animation: bulb-glint 390ms 70ms ease-out; }
}

.game[data-chapter="harbour"] { --chapter-light: #edfff0; --chapter-color: #a7d9c8; --chapter-edge: #639c95; }
.game[data-chapter="games"] { --chapter-light: #fff5d3; --chapter-color: #ecc190; --chapter-edge: #bd8862; }
.game[data-chapter="coast"] { --chapter-light: #edfaff; --chapter-color: #b0cfe0; --chapter-edge: #758fa9; }
.game[data-chapter="lights"] { --chapter-light: #f1eeff; --chapter-color: #c7bbe6; --chapter-edge: #9683bc; }
.game[data-chapter="summit"] { --chapter-light: #fff9d9; --chapter-color: #e9d28d; --chapter-edge: #af9156; }
.game[data-chapter]:not([data-chapter="cove"]) .reward-marquee {
  background: linear-gradient(177deg, var(--chapter-light), var(--chapter-color) 58%, var(--chapter-edge));
}
.game[data-chapter]:not([data-chapter="cove"]) .marquee-copy small { color: #273b42; }
.game[data-chapter]:not([data-chapter="cove"]) .result {
  border-color: var(--chapter-edge);
  background: var(--grain), radial-gradient(ellipse at 50% 20%, #fff8d0 1%, transparent 49%),
    linear-gradient(155deg, var(--chapter-light), var(--chapter-color));
  box-shadow: inset 0 0 0 3px var(--chapter-light), inset 0 0 0 5px var(--chapter-edge), 0 5px 14px #1a333e8c;
}
.result-chapter { margin: .3rem 0 0; color: #3b4d53; font-size: .84rem; font-weight: 850; }
.game .result[data-finale="true"] .victory-scene::after { color: #8a591e; text-shadow: 0 0 8px #fff5b5; }
.current-run-level { margin: .35rem 0 .65rem; color: var(--muted); font-size: .9rem; font-weight: 800; }
.chapter-choice { display: grid; gap: .28rem; font-weight: 850; font-size: .87rem; }
.chapter-choice select { width: 100%; padding-inline: .68rem; }
.game-picker .stage-list {
  max-height: min(49vh, 23rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: .2rem .24rem .35rem;
}
.stage-select[aria-current="step"] { border-color: #4a7769; box-shadow: inset 0 0 0 1px #4a7769; }
.stage-select small { flex: 0 1 auto; white-space: normal; text-align: right; }

.score:has(.wave-heading:not([hidden])) {
  grid-template-areas: "points pairs" "wave wave";
  row-gap: .27rem;
  padding-bottom: .78rem;
}
.score:has(.wave-heading:not([hidden])) .live-points { grid-area: points; }
.wave-heading:not([hidden]) {
  grid-area: wave;
  display: flex;
  align-items: baseline;
  gap: .45rem;
  font-size: .8rem;
  line-height: 1.2;
}
#wave-label { color: #fff3da; font-weight: 900; }
#wave-name { overflow: hidden; text-overflow: ellipsis; color: #d5e5dd; font-size: .73rem; }
.score:has(.wave-heading:not([hidden])) .pair-count {
  grid-area: pairs;
  justify-self: end;
  text-align: right;
  font-size: .78rem;
}
.lesson-slot { display: none; }
.lesson-slot:has(.stage-tip:not([hidden])) {
  display: flex; align-items: center; gap: .3rem;
  padding-inline: .5rem .2rem; background: #fcf0d8; color: #473d31;
}
.lesson-peppy { width: 1.8rem; flex: none; }
.lesson-slot .stage-tip {
  flex: 1; display: flex; align-items: center; justify-content: space-between; gap: .1rem;
  padding: 0; margin: 0; background: transparent; border: 0; color: inherit;
}
.lesson-slot .stage-tip p { font: 800 .81rem/1.2 var(--type); margin: 0; }
.lesson-slot .tip-dismiss { flex: none; width: 44px; min-height: 44px; position: static; }
@media (max-height: 630px) and (orientation: portrait) {
  .game[data-natural-tiles="true"] .board { max-height: none; }
}
@media (max-width: 350px) {
  .game .score .live-points .combo-badge { grid-row: 1; align-self: center; grid-column: 2; }
}
.tile[data-special="fish-flop"][aria-disabled="false"][aria-pressed="false"][data-hinted="false"] {
  border: 2px solid #965d40;
  border-bottom: 5px solid #a66d4f;
  background: var(--grain) #ffeacd;
  box-shadow: inset 0 0 0 2px #fff8e8, inset 0 0 0 3px #daa376, 0 2px 2px #20323199;
}
.power-callout[data-kind="fish"] { background: #ffe5bc; color: #53331f; border-color: #c08452; }
.power-callout[data-kind="wave"] { background: #e8f5df; color: #244d44; }
.flop-effect { position: absolute; z-index: 18; inset: 0; pointer-events: none; overflow: clip; }
.flop-piece {
  position: absolute; display: grid; place-items: center;
  border-radius: .5rem; border: 2px solid #a9653c; border-bottom-width: 4px;
  background: var(--grain) #fff0d9; box-shadow: inset 0 0 0 2px #fff9eb;
}
.flop-friend,.flop-diver { z-index: 2; }
.flop-target { border: 3px dashed #77492f; background-color: #fff1cd; z-index: 1; }
@media (prefers-reduced-motion: no-preference) {
  #pair-progress { transition: width 160ms ease-out; }
  .flop-friend { animation: fish-puff-away 410ms ease-in-out both; }
  .flop-diver { animation: fish-belly 490ms cubic-bezier(.35,.05,.48,1) both; }
  .flop-target { animation: fish-loosen 630ms ease-out var(--stagger) both; }
  @keyframes fish-puff-away {
    0% { transform: scale(1); } 43% { transform: scale(1.23) rotate(-8deg); }
    100% { transform: scale(.83); opacity: 0; }
  }
  @keyframes fish-belly {
    0% { transform: scale(1); } 28% { transform: translateY(-5px) scale(1.26); }
    47% { transform: translate(calc(var(--belly-x)*.55),-13px) rotate(-23deg) scale(1.18); }
    62% { transform: translate(var(--belly-x),var(--belly-y)) rotate(23deg) scale(1.24,.78); }
    78% { opacity: 1; }
    100% { transform: translate(var(--belly-x),var(--belly-y)) rotate(15deg) scale(.88); opacity: 0; }
  }
  @keyframes fish-loosen {
    0%,45% { transform: none; opacity: 1; }
    56% { transform: rotate(-6deg); } 69% { transform: rotate(7deg); }
    81% { transform: rotate(-3deg); opacity: 1; }
    100% { transform: translate(var(--slide),7px) rotate(8deg); opacity: 0; }
  }
}
@media (max-height: 630px) and (orientation: portrait) {
  .result[data-finale="true"] { padding-block: .55rem .6rem; }
  .result[data-finale="true"] .victory-peppy { width: 4.75rem; }
  .result[data-finale="true"] .result-totals { margin-top: .65rem; }
}

/* Lucky tiles and the pop-up wheel. */
.game .tile[data-special="lucky"] {
  border-radius: .25rem .86rem .25rem .86rem;
}
.game .tile[data-special="lucky"][aria-pressed="false"][data-hinted="false"][aria-disabled="false"] {
  background: var(--grain), repeating-linear-gradient(133deg, #fff9 0 2px, transparent 2px 12px),
    linear-gradient(150deg, #fbfff2 6%, #c6e8e3 62%, #91c6c9);
  border: 2px solid #456e73;
  border-bottom: 5px solid #588e95;
  box-shadow: inset 0 0 0 1.5px #f4fff4, 1px 3px 2px #23434e87;
}
.game .tile[data-special="lucky"] .motif { width: 86%; height: 91%; }
.lucky-wheel {
  width: min(21rem, calc(100% - 1.4rem));
  padding: .78rem .76rem .7rem;
  text-align: center;
  border: 2px solid #7ba9aa;
  background: var(--grain), radial-gradient(ellipse at top, #f5fff2 0%, #eff3df 53%, #d7ece1);
  color: #203f48;
  box-shadow: inset 0 0 0 3px #f9fff3, 0 5px 0 #426c75, 0 14px 44px #1b334296;
}
.lucky-wheel::backdrop { background: #172f37ab; }
.wheel-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  text-align: left;
}
.wheel-header .wheel-peppy { width: 3rem; flex: none; }
.wheel-header small {
  color: #526e71;
  font-size: .68rem;
  letter-spacing: .13em;
  text-transform: uppercase;
  font-weight: 900;
}
.lucky-wheel .wheel-header h2 { font-size: clamp(1.08rem, 6vw, 1.46rem); }
.wheel-pocket {
  width: min(100%, 14rem, 49vh);
  aspect-ratio: 1;
  position: relative;
  margin: .24rem auto .3rem;
}
@supports (height: 100dvh) {
  .wheel-pocket { width: min(100%, 14rem, 49dvh); }
}
.wheel-disc { display: block; width: 100%; height: 100%; transform-origin: center; }
.wheel-edge { fill: #c0e2e4; stroke: #426f79; stroke-width: 4; }
.wheel-ring { fill: none; stroke: #f4fff7; stroke-width: 3; }
.wheel-hub { fill: #fff2ca; stroke: #598089; stroke-width: 2.2; }
.wheel-star { fill: #a16c3b; }
.wheel-slice { stroke: #527c86; stroke-width: 1.9; stroke-linejoin: round; }
.lucky-wheel [data-winner="true"] > .wheel-slice { stroke: #284d56; stroke-width: 3.5; }
.wheel-pointer {
  position: absolute;
  top: -5%;
  left: 50%;
  width: 15%;
  transform: translateX(-50%);
  overflow: visible;
  fill: #ffd58a;
  stroke: #675036;
  stroke-width: 2.5;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 1px #203c4687);
}
.lucky-wheel[data-state="waiting"] .wheel-pocket { visibility: hidden; }
.lucky-wheel[data-state="landed"] .wheel-disc { transform: rotate(var(--wheel-stop)); }
.wheel-reward {
  margin: .16rem 0 0;
  padding: .25rem .72rem;
  background: #fff5d9;
  box-shadow: inset 0 0 0 1px #beab84;
  border-radius: .56rem;
  color: #26464c;
  font-size: 1.13rem;
  font-weight: 900;
}
.wheel-snow { position: absolute; top: 17%; left: 50%; opacity: 0; pointer-events: none; }
.wheel-snow::before, .wheel-snow::after {
  content: ""; position: absolute; width: 5px; height: 5px; border-radius: 50%; background: #fff;
  box-shadow: 17px 3px #fff, -14px 7px #f6fff3, -22px -7px #fff6db, 24px -4px #fff;
}
.wheel-snow::after { transform: scaleX(-1) scale(.76); }

.lucky-effect { position: absolute; z-index: 18; inset: 0; pointer-events: none; overflow: hidden; }
.lucky-effect[data-effect="ice-burst"]::before,
.lucky-effect[data-effect="aurora-slide"]::before {
  content: ""; position: absolute; inset: 0;
}
.lucky-effect[data-effect="ice-burst"]::before {
  background: radial-gradient(circle at var(--hit-x) var(--hit-y), transparent 11%, #d8fffa98 21%, transparent 38%);
}
.lucky-effect[data-effect="aurora-slide"]::before {
  background: linear-gradient(115deg, transparent 21%, #a1f0bc62 32%, #c3afea7a 42%, #b5e8e473 52%, transparent 67%);
}
.lucky-ice-target, .lucky-fish {
  display: grid; place-items: center; position: absolute;
}
.lucky-ice-target {
  border: 2px dashed #294c68; border-radius: .55rem; background: #daf4ed;
  box-shadow: inset 0 0 0 2px #fcfff1, 0 0 .4rem #adf3f2;
}
.lucky-ice-target::before, .lucky-ice-target::after {
  content: ""; position: absolute; width: 26%; height: 30%; opacity: 0;
  background: #eafffa; clip-path: polygon(0 0, 100% 22%, 50% 100%);
}
.lucky-ice-target::before { --chip-x: -24px; left: 16%; top: 33%; }
.lucky-ice-target::after { --chip-x: 22px; right: 17%; top: 36%; }
.lucky-crack { position: absolute; width: 84%; height: 84%; opacity: .68; }
.lucky-fish { z-index: 2; filter: drop-shadow(0 2px 2px #25414d9e); }
.lucky-fish .motif { width: 100%; height: 100%; }
.tile[data-lucky-glide="true"] { outline: 2px dashed #544a7b; outline-offset: -4px; }

@media (prefers-reduced-motion: no-preference) {
  .lucky-wheel[data-state="spinning"] .wheel-disc {
    animation: wheel-spin var(--spin-ms) cubic-bezier(.21,.65,.19,1) both;
  }
  .lucky-wheel[data-state="landed"] .wheel-snow { animation: wheel-snow 490ms ease-out both; }
  .lucky-wheel[data-state="landed"] .wheel-peppy { animation: wheel-cheer 475ms ease-out both; }
  .lucky-effect[data-effect="ice-burst"]::before { animation: lucky-ripple 480ms ease-out both; }
  .lucky-effect[data-effect="aurora-slide"]::before { animation: lucky-aurora 560ms ease-out both; }
  .lucky-ice-target { animation: lucky-shatter 460ms ease-out var(--stagger) both; }
  .lucky-ice-target::before, .lucky-ice-target::after { animation: lucky-chip 460ms ease-out var(--stagger) both; }
  .lucky-crack { animation: lucky-crack 460ms ease-out var(--stagger) both; }
  @keyframes wheel-spin { from { transform: rotate(0deg); } to { transform: rotate(var(--wheel-stop)); } }
  @keyframes wheel-cheer { 40% { transform: translateY(-3px) rotate(-8deg); } }
  @keyframes wheel-snow {
    0% { transform: scale(.45); opacity: 1; }
    100% { transform: scale(2.65) translateY(-4px); opacity: 0; }
  }
  @keyframes lucky-ripple {
    0% { transform: scale(.5); opacity: .5; }
    45% { opacity: 1; }
    100% { transform: scale(1.52); opacity: 0; }
  }
  @keyframes lucky-shatter {
    0%, 46% { opacity: 1; transform: none; }
    60% { transform: scale(1.08); }
    100% { opacity: 0; transform: translate(var(--slide), 8px) rotate(8deg) scale(.86); }
  }
  @keyframes lucky-crack { 0%, 20% { opacity: 0; } 54%, 83% { opacity: 1; } }
  @keyframes lucky-chip {
    0%, 49% { opacity: 0; transform: none; }
    63% { opacity: 1; }
    100% { opacity: 0; transform: translate(var(--chip-x), -23px) rotate(45deg); }
  }
  @keyframes lucky-aurora {
    0% { transform: translateX(-54%); opacity: 0; }
    38% { opacity: 1; }
    100% { transform: translateX(65%); opacity: 0; }
  }
}
