@font-face {
  font-family: DM;
  src: url("assets/fonts/dm-sans.woff2") format("woff2");
  font-display: swap;
  font-weight: 100 1000;
}
:root {
  --paper: #f2f8ff;
  --ink: #142c52;
  --muted: #536883;
  --green: #1760dc;
  --accent: #e3433d;
  --line: #d4e3f5;
  --cream: #e7f1ff;
  --gold: #e99d00;
  --board: #d5ecff;
  --board-line: #8abbe5;
  --card: #ffffff;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: DM, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.55;
}
button,
input,
select {
  font: inherit;
}
button,
a,
input,
select {
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
  color: inherit;
  border: 0;
  background: none;
  touch-action: manipulation;
}
button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
button,
a {
  transition:
    background 0.18s,
    transform 0.18s,
    color 0.18s;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
svg:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}
button:not(:disabled):active {
  transform: translateY(1px);
}
a {
  color: inherit;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h1,
h2,
h3 {
  line-height: 1.17;
  letter-spacing: -0.045em;
  font-weight: 800;
}
h2 {
  font-size: 32px;
}
h3 {
  font-size: 21px;
}
p {
  color: var(--muted);
}
.icon {
  width: 21px;
  height: 21px;
  flex-shrink: 0;
  vertical-align: middle;
}
.icon-btn {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--card);
  flex-shrink: 0;
}
.icon-btn:hover {
  background: var(--cream);
}
.primary,
.secondary,
.soft-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-weight: 600;
  border-radius: 11px;
  min-height: 49px;
  padding: 12px 21px;
}
.primary {
  background: var(--green);
  color: #ffffff;
}
.primary:hover {
  background: #124cb3;
}
.secondary {
  border: 1px solid #b8d0f0;
  background: transparent;
}
.secondary:hover {
  background: var(--cream);
}
.soft-btn {
  background: #e0efff;
  min-height: 43px;
  padding: 10px 15px;
  font-size: 13px;
}
.text-btn {
  padding: 8px 0;
  display: inline-flex;
  gap: 9px;
  align-items: center;
  font-weight: 600;
  font-size: 13px;
}
.eyebrow {
  display: block;
  font-size: 10px;
  letter-spacing: 0.17em;
  font-weight: 750;
  text-transform: uppercase;
  color: var(--muted);
}
.pill {
  border: 1px solid var(--line);
  border-radius: 30px;
  padding: 7px 13px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}
.coin-pill {
  color: #704200;
  background: #ffdf5e;
  border-color: #efb528;
}
.coin-pill .icon {
  width: 17px;
  height: 17px;
}
.shell {
  display: grid;
  grid-template-columns: 228px minmax(0, 1fr);
  min-height: 100dvh;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  border-right: 1px solid var(--line);
  padding: 33px 22px 22px;
  display: flex;
  flex-direction: column;
  background: #ffffff;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  padding: 0;
  text-align: left;
  font-size: 23px;
  font-weight: 750;
  letter-spacing: -1px;
}
.brand img {
  width: 39px;
  height: 39px;
  border-radius: 12px;
}
.brand-sub {
  font-size: 10px;
  margin: 8px 0 41px 50px;
  color: var(--muted);
  letter-spacing: 0.03em;
}
.nav {
  display: grid;
  gap: 8px;
}
.nav button {
  display: flex;
  align-items: center;
  gap: 13px;
  text-align: left;
  padding: 13px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 550;
  color: #506781;
}
.nav button.active {
  color: var(--green);
  background: #dcebff;
  font-weight: 700;
}
.nav button:hover {
  background: #eaf2ff;
}
.nav .icon {
  width: 19px;
  height: 19px;
}
.sidebar-bottom {
  margin-top: auto;
}
.mini-progress {
  padding: 17px;
  background: #e7f1ff;
  border-radius: 13px;
  margin: 35px 0 20px;
}
.mini-progress .eyebrow {
  font-size: 9px;
}
.mini-progress strong {
  display: block;
  margin: 9px 0;
  font-size: 13px;
}
.mini-progress progress {
  height: 4px;
}
.sidebar-bottom .settings-button {
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 12px;
  padding: 13px 15px;
}
.sidebar-bottom small {
  display: block;
  color: #62768e;
  font-size: 10px;
  padding: 12px 15px;
}
.main {
  min-width: 0;
  padding: 0 44px 32px;
  max-width: 1600px;
  width: 100%;
  margin: auto;
}
.topbar {
  height: 87px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  gap: 16px;
}
.breadcrumb {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  gap: 10px;
  align-items: center;
}
.top-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}
.language-small {
  border: 0;
  background: transparent;
  font-size: 11px;
  padding: 8px;
  color: var(--muted);
}
.avatar {
  width: 34px;
  height: 34px;
  background: #ffda54;
  display: grid;
  place-items: center;
  border-radius: 50%;
}
.avatar .icon {
  width: 17px;
}
.page {
  padding-top: 32px;
  animation: enter 0.3s ease-out;
}
.hero {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  align-items: center;
  gap: 20px;
  min-height: 390px;
  padding: 14px 0 28px;
}
.hero .eyebrow {
  color: var(--accent);
  font-size: 10px;
  letter-spacing: 0.16em;
}
.hero h1 {
  font-family: DM, "Segoe UI", sans-serif;
  font-size: clamp(44px, 4.7vw, 69px);
  font-weight: 850;
  letter-spacing: -0.055em;
  line-height: 1.05;
  margin: 19px 0 20px;
  white-space: pre-line;
}
.hero p {
  max-width: 350px;
  font-size: 13px;
  line-height: 1.8;
  margin-bottom: 23px;
}
.hero .primary {
  font-size: 13px;
  min-height: 48px;
}
.hero-caption {
  display: flex;
  gap: 17px;
  margin-top: 20px;
  font-size: 10px;
  color: var(--muted);
  align-items: center;
}
.hero-caption .icon {
  width: 13px;
  height: 13px;
  color: var(--green);
}
.hero-art {
  position: relative;
  aspect-ratio: 1.12;
  display: flex;
  align-items: center;
  justify-content: center;
  isolation: isolate;
}
.hero-art:before {
  content: "";
  position: absolute;
  inset: 10% 9%;
  background: #69cafa;
  border-radius: 50%;
  z-index: -1;
}
.hero-picture {
  width: 76%;
  aspect-ratio: 1;
  transform: rotate(-5deg);
  border: 8px solid #ffffff;
  box-shadow: 0 14px 35px #1953a421;
  border-radius: 12px;
}
.hero-art .floating-piece {
  position: absolute;
  width: 30%;
  bottom: 3%;
  right: 0;
  transform: rotate(12deg);
  filter: drop-shadow(0 7px 7px #1953a428);
}
.art-note {
  position: absolute;
  top: 9%;
  right: 1%;
  padding: 9px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 10px;
  transform: rotate(5deg);
  box-shadow: 0 3px 10px #1953a410;
}
.art-note .icon {
  color: var(--gold);
  width: 14px;
  height: 14px;
  margin-right: 4px;
}
.hero-spark {
  position: absolute;
  left: 3%;
  top: 17%;
  font-size: 37px;
  color: var(--gold);
}
.hero-dots {
  position: absolute;
  bottom: 17%;
  left: 5%;
  color: var(--accent);
  font-size: 26px;
  letter-spacing: 5px;
}
.mode-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin: 7px 0 35px;
}
.mode-card {
  display: flex;
  text-align: left;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  gap: 18px;
  padding: 23px;
  background: #dceeff;
  min-height: 129px;
}
.mode-card:nth-child(2) {
  background: #fff0bc;
  border-color: #f6d052;
}
.mode-card:hover {
  transform: translateY(-3px);
}
.mode-illustration {
  width: 59px;
  height: 64px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: #1760dc;
  color: white;
  transform: rotate(-5deg);
}
.mode-illustration .icon {
  width: 34px;
  height: 34px;
}
.mode-card:nth-child(2) .mode-illustration {
  background: #ffcd38;
  color: #753900;
  transform: rotate(6deg);
}
.mode-card h3 {
  font-size: 17px;
  letter-spacing: -0.035em;
  margin: 0 0 7px;
}
.mode-card p {
  font-size: 11px;
  line-height: 1.6;
  margin: 0;
  max-width: 270px;
}
.mode-card > .icon {
  margin-left: auto;
  width: 18px;
}
.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin: 0 0 20px;
}
.section-heading .eyebrow {
  font-size: 9px;
  margin-bottom: 9px;
}
.section-heading h2 {
  font-size: 27px;
  margin: 0;
}
.section-heading .text-btn {
  font-size: 11px;
}
.puzzle-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 19px;
}
.puzzle-card {
  text-align: left;
  padding: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  position: relative;
}
.puzzle-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 18px #1953a410;
}
.puzzle-thumb {
  position: relative;
  aspect-ratio: 1.22;
  overflow: hidden;
  background: var(--cream);
}
.puzzle-thumb > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.card-badge {
  position: absolute;
  left: 10px;
  top: 10px;
  background: #ffffffef;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 9px;
  font-weight: 700;
}
.card-lock {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: #ffffffef;
  border-radius: 50%;
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
}
.card-lock .icon {
  width: 13px;
  height: 13px;
}
.card-content {
  padding: 12px 13px;
}
.card-content .eyebrow {
  font-size: 8px;
  letter-spacing: 0.12em;
}
.card-content h3 {
  font-size: 14px;
  letter-spacing: -0.025em;
  margin: 6px 0 9px;
}
.card-meta {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: var(--muted);
}
.card-stars {
  color: var(--gold);
  letter-spacing: 2px;
}
.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 29px 0 5px;
  margin-top: 25px;
  border-top: 1px solid var(--line);
  font-size: 10px;
  color: var(--muted);
}
.footer span {
  display: flex;
  align-items: center;
  gap: 6px;
}
.footer .icon {
  width: 13px;
  height: 13px;
}
.collection-head h1,
.standard-head h1 {
  font-size: 43px;
  margin: 6px 0 13px;
  font-family: DM, "Segoe UI", sans-serif;
  font-weight: 850;
}
.standard-head p {
  font-size: 14px;
  max-width: 540px;
}
.filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 5px 0 17px;
  margin-bottom: 12px;
  scrollbar-width: thin;
}
.filter {
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: 30px;
  padding: 8px 16px;
  font-size: 11px;
}
.filter.active {
  background: var(--green);
  color: white;
  border-color: var(--green);
}
.searchbox {
  position: relative;
  max-width: 360px;
  margin: 20px 0;
}
.searchbox input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 14px 11px 41px;
  background: var(--card);
  font-size: 12px;
}
.searchbox .icon {
  position: absolute;
  left: 12px;
  top: 12px;
  width: 18px;
}
.pagination {
  display: flex;
  justify-content: center;
  gap: 20px;
  align-items: center;
  margin: 28px 0;
  font-size: 12px;
}
.pagination button {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 16px;
}
.dialog-backdrop {
  position: fixed;
  inset: 0;
  background: #142c5277;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(5px);
}
.dialog {
  background: var(--paper);
  border: 1px solid #fff9;
  border-radius: 22px;
  width: min(100%, 460px);
  padding: 30px;
  max-height: 93dvh;
  overflow: auto;
  box-shadow: 0 20px 80px #142c5233;
  position: relative;
  animation: enter 0.25s ease-out;
}
.dialog > .close-dialog {
  position: absolute;
  right: 15px;
  top: 15px;
  width: 32px;
  height: 32px;
}
.dialog h2 {
  font-size: 28px;
  margin: 10px 0 15px;
}
.dialog p {
  font-size: 13px;
  line-height: 1.7;
}
.dialog label {
  display: block;
  font-size: 11px;
  font-weight: 650;
  margin: 18px 0 7px;
}
.dialog select {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 9px;
}
.dialog .primary,
.dialog .secondary {
  width: 100%;
  margin-top: 10px;
  font-size: 13px;
}
.dialog-img {
  width: 100%;
  aspect-ratio: 1.4;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 15px;
}
.dialog .small {
  font-size: 11px;
}
.dialog.preview-dialog {
  width: min(90vw, 650px);
}
.preview-image {
  width: 100%;
  border-radius: 12px;
}
.segments {
  display: flex;
  gap: 8px;
}
.segments button {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px;
  flex: 1;
  font-size: 12px;
}
.segments button.active {
  background: #dceaff;
  border-color: #1760dc;
}
.result-dialog {
  text-align: center;
}
.result-art {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 13px;
  transform: rotate(-6deg);
  margin: 5px 0 22px;
  border: 5px solid white;
  box-shadow: 0 7px 13px #1953a422;
}
.result-stars {
  font-size: 31px;
  letter-spacing: 10px;
  color: var(--gold);
  margin: 5px 0 20px;
}
.result-stats {
  display: flex;
  gap: 9px;
  margin: 20px 0;
}
.result-stats > div {
  background: #e6f2ff;
  border-radius: 10px;
  padding: 13px 5px;
  flex: 1;
  font-size: 10px;
  color: var(--muted);
}
.result-stats b {
  display: block;
  font-size: 20px;
  color: var(--green);
  margin-top: 4px;
}
.confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.confetti i {
  position: absolute;
  top: -15px;
  width: 7px;
  height: 13px;
  background: var(--gold);
  animation: fall 2.4s ease-in both;
  animation-delay: calc(var(--i) * 0.06s);
  left: calc(var(--i) * 5%);
}
.confetti i:nth-child(2n) {
  background: var(--accent);
  border-radius: 50%;
}
.confetti i:nth-child(3n) {
  background: var(--green);
}
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translate(-50%, 20px);
  background: var(--green);
  color: white;
  box-shadow: 0 6px 20px #0002;
  border-radius: 10px;
  padding: 12px 22px;
  font-size: 13px;
  max-width: 90vw;
  width: max-content;
  opacity: 0;
  pointer-events: none;
  z-index: 60;
  transition: 0.2s;
}
#toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}
.game-heading {
  display: flex;
  gap: 15px;
  align-items: center;
  margin-bottom: 22px;
}
.game-heading h1 {
  font-size: 23px;
  margin: 4px 0 0;
}
.game-heading .eyebrow {
  font-size: 9px;
}
.game-clock {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  font-size: 19px;
}
.game-clock .icon {
  width: 18px;
  color: var(--muted);
}
.game-progress {
  margin-bottom: 22px;
}
.game-progress > div {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 7px;
}
progress {
  width: 100%;
  height: 6px;
  display: block;
  border: 0;
  border-radius: 20px;
  overflow: hidden;
  background: #d4e3f5;
  accent-color: var(--green);
}
progress::-webkit-progress-bar {
  background: #d4e3f5;
}
progress::-webkit-progress-value {
  background: var(--green);
  border-radius: 20px;
  transition: width 0.2s;
}
progress::-moz-progress-bar {
  background: var(--green);
}
.puzzle-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  gap: 26px;
}
.board-column {
  min-width: 0;
}
.board-viewport {
  max-width: 600px;
  width: 100%;
  aspect-ratio: 1;
  overflow: auto;
  border-radius: 9px;
  background: var(--board);
  border: 9px solid var(--card);
  box-shadow: 0 3px 18px #1953a414;
  scrollbar-width: thin;
  overscroll-behavior: contain;
  touch-action: pan-x pan-y;
  margin: auto;
}
.board-wrap {
  width: 100%;
  aspect-ratio: 1;
  line-height: 0;
}
#board {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}
#board:focus {
  outline-offset: -4px;
}
.board-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 15px;
  gap: 8px;
}
.zoom-tools {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #e6f2ff;
  border: 1px solid var(--line);
  border-radius: 20px;
}
.zoom-tools .icon-btn {
  width: 30px;
  height: 30px;
  border: 0;
  background: transparent;
}
.zoom-tools .icon {
  width: 14px;
  height: 14px;
}
.zoom-tools > button {
  font-size: 10px;
}
.saved-note {
  font-size: 9px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 5px;
}
.saved-note .icon {
  width: 13px;
  height: 13px;
}
.play-tools {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 22px 0 10px;
}
.game-help {
  font-size: 10px;
  text-align: center;
  max-width: 470px;
  margin: 15px auto;
  line-height: 1.7;
}
.tray-panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 15px;
  background: #ffffff;
  align-self: start;
}
.tray-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.tray-title h2 {
  font-size: 16px;
  margin: 0;
  letter-spacing: -0.02em;
}
.tray-title .icon-btn {
  width: 30px;
  height: 30px;
  background: none;
  border: 0;
}
.tray-title .icon {
  width: 16px;
}
.filter-btn {
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  width: 100%;
  margin: 12px 0;
  background: var(--card);
}
.filter-btn[aria-pressed="true"] {
  background: #dceaff;
}
.filter-btn .icon {
  width: 14px;
  height: 14px;
}
.piece-tray {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  max-height: 490px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px;
}
.piece {
  padding: 1px;
  aspect-ratio: 1;
  cursor: grab;
  border: 1px solid transparent;
  border-radius: 7px;
  touch-action: none;
  min-width: 0;
}
.piece svg {
  width: 100%;
  height: 100%;
  display: block;
  filter: drop-shadow(0 2px 1px #142c5228);
}
.piece:hover {
  background: #e0efff;
}
.piece.selected {
  border-color: var(--green);
  background: #cce5ff;
}
.drag-ghost {
  position: fixed;
  transform: translate(-50%, -50%);
  z-index: 40;
  pointer-events: none;
  filter: drop-shadow(0 8px 5px #142c5244);
}
.drag-ghost svg {
  display: block;
  width: 100%;
  height: 100%;
}
#tray-empty {
  font-size: 12px;
  padding: 15px 2px;
  text-align: center;
}
.loading-board {
  position: absolute;
  inset: 0;
  background: #f2f8ffef;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
}
.game {
  position: relative;
}
.opponent {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #fff0bc;
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 10px;
  font-size: 11px;
}
.opponent span {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.opponent .icon {
  width: 15px;
}
.opponent progress {
  height: 5px;
}
.opponent progress::-webkit-progress-value {
  background: var(--accent);
}
.online-state {
  text-align: center;
  font-size: 12px;
  min-height: 20px;
}
.race-panel {
  max-width: 690px;
  margin: 20px auto;
  text-align: center;
  border: 1px solid var(--line);
  background: #ffffff;
  border-radius: 22px;
  padding: 42px;
}
.race-panel h2 {
  font-family: DM, "Segoe UI", sans-serif;
  font-size: 34px;
  font-weight: 850;
}
.race-panel p {
  font-size: 13px;
}
.race-panel .segments {
  max-width: 430px;
  margin: 26px auto;
}
.race-panel .primary {
  min-width: 230px;
}
.race-rules {
  margin: 25px 0 0;
  font-size: 11px !important;
  line-height: 1.8;
}
.matching-art {
  width: 180px;
  height: 170px;
  position: relative;
  margin: 0 auto 25px;
}
.matching-art > svg {
  position: absolute;
  width: 89px;
  height: 89px;
  top: 35px;
  left: 15px;
  color: var(--green);
  fill: #4da5ff;
  stroke-width: 0.8;
  animation: orbit 3s ease-in-out infinite;
}
.matching-art > svg:nth-child(2) {
  left: 80px;
  top: 60px;
  color: var(--accent);
  fill: #ffce36;
  animation-delay: -1.5s;
}
.matching-art:after {
  content: "✦";
  position: absolute;
  top: 10px;
  right: 25px;
  color: var(--gold);
  font-size: 27px;
  animation: twinkle 2s infinite;
}
.queue-time {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 13px;
  margin: 15px;
}
.shop-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 25px;
}
.shop-card {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 15px;
  padding: 22px;
  display: flex;
  flex-direction: column;
}
.shop-card h2 {
  font-size: 21px;
}
.shop-card p {
  font-size: 12px;
  flex: 1;
}
.shop-card .primary {
  font-size: 12px;
}
.shop-art {
  height: 115px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #ffdb4f;
  margin-bottom: 20px;
}
.shop-art .icon {
  width: 60px;
  height: 60px;
  stroke-width: 1;
}
.shop-card.hint-pack {
  grid-column: span 2;
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 23px;
  align-items: center;
  background: #fff5ce;
}
.shop-card.hint-pack .shop-art {
  height: 100%;
  margin: 0;
  background: #ffcf36;
}
.shop-note {
  font-size: 12px;
  max-width: 680px;
  margin-top: 25px;
  line-height: 1.8;
}
.reward-panel {
  border: 1px dashed #9fbbdd;
  border-radius: 15px;
  padding: 22px;
  margin: 25px 0;
}
.reward-panel p {
  font-size: 12px;
  margin: 8px 0 0;
}
.settings-panel {
  max-width: 700px;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 15px;
  padding: 8px 25px;
}
.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.setting-row:last-child {
  border: 0;
}
.setting-row select {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--paper);
}
.switch {
  width: 43px;
  height: 25px;
  background: #c4d3e7;
  border-radius: 25px;
  position: relative;
  flex-shrink: 0;
}
.switch:after {
  content: "";
  position: absolute;
  left: 4px;
  top: 4px;
  background: white;
  border-radius: 50%;
  width: 17px;
  height: 17px;
  transition: 0.2s;
}
.switch[aria-checked="true"] {
  background: var(--green);
}
.switch[aria-checked="true"]:after {
  left: 22px;
}
.danger {
  color: #bf2738;
}
.theme-sage {
  --board: #d9ccff;
  --board-line: #9874df;
}
.theme-clay {
  --board: #ffe178;
  --board-line: #c89b1d;
}
.theme-midnight {
  --board: #203d88;
  --board-line: #6c8bda;
}
.no-motion * {
  scroll-behavior: auto;
}
.no-motion * {
  animation: none !important;
  transition: none !important;
}
.mobile-brand {
  display: none;
}
.empty-state {
  padding: 60px;
  text-align: center;
  grid-column: 1/-1;
}
.badge-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  letter-spacing: 0.05em;
  color: var(--green);
}
.badge-live:before {
  content: "";
  width: 6px;
  height: 6px;
  background: #139951;
  border-radius: 50%;
}
.standard-head {
  margin: 6px 0 24px;
}
.shop-balance {
  font-size: 30px;
  display: flex;
  gap: 12px;
  align-items: center;
}
.shop-balance .icon {
  width: 30px;
  height: 30px;
  color: var(--gold);
}
.privacy-page {
  max-width: 800px;
  margin: 40px auto;
  padding: 24px;
}
.privacy-page h1 {
  font-size: 37px;
}
.privacy-page h2 {
  font-size: 24px;
  margin-top: 35px;
}
.privacy-page p {
  font-size: 14px;
  line-height: 1.8;
}
@keyframes enter {
  from {
    opacity: 0;
    transform: translateY(9px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes orbit {
  0%,
  100% {
    transform: translate(-5px, -8px) rotate(-12deg);
  }
  50% {
    transform: translate(8px, 9px) rotate(8deg);
  }
}
@keyframes twinkle {
  50% {
    transform: scale(0.65) rotate(40deg);
    opacity: 0.5;
  }
}
@keyframes fall {
  to {
    transform: translate(25px, 540px) rotate(480deg);
    opacity: 0;
  }
}

/* Bright, solid-color play surfaces. Board theme IDs stay stable for saved purchases. */
.primary {
  font-weight: 800;
  border-radius: 16px;
  box-shadow: 0 4px 0 #0c3e9c;
}
.secondary,
.soft-btn {
  font-weight: 750;
  border-radius: 14px;
}
.secondary {
  background: white;
  border-width: 2px;
}
.icon-btn {
  border-width: 2px;
}
.brand {
  color: #154eaf;
  font-weight: 900;
}
.nav button {
  font-weight: 750;
}
.nav button.active {
  background: #1760dc;
  color: white;
  box-shadow: 0 3px 0 #104ba9;
}
.nav button:not(.active):nth-child(2) .icon {
  color: #e3433d;
}
.nav button:not(.active):nth-child(3) .icon {
  color: #7550cf;
}
.nav button:not(.active):nth-child(4) .icon {
  color: #b87500;
}
.hero {
  background: #e5f4ff;
  border: 2px solid #c4e6ff;
  border-radius: 28px;
  padding: 30px;
  margin-bottom: 24px;
}
.hero h1 {
  color: #154eaf;
  font-weight: 900;
  letter-spacing: -0.05em;
}
.hero .eyebrow {
  color: #b52a33;
  font-weight: 850;
}
.hero .primary {
  background: #e33c3c;
  box-shadow: 0 4px 0 #a32330;
  min-height: 54px;
}
.hero .primary:hover {
  background: #c93037;
}
.hero p {
  color: #3e5d80;
  font-size: 15px;
}
.hero-picture {
  border-radius: 20px;
  box-shadow:
    0 7px 0 #2182d344,
    0 18px 24px #145db522;
}
.art-note {
  background: #ffdf5e;
  color: #573500;
  border: 2px solid #ffffff;
  font-weight: 850;
}
.hero-spark {
  color: #ffc426;
}
.mode-card {
  border-width: 2px;
  border-radius: 20px;
  box-shadow: 0 4px 0 #bfd9f2;
}
.mode-card:nth-child(2) {
  box-shadow: 0 4px 0 #ecd280;
}
.mode-card h3 {
  font-weight: 850;
  font-size: 20px;
}
.mode-card p {
  color: #445c7a;
  font-size: 12px;
}
.mode-illustration {
  color: white;
}
.puzzle-card {
  border-radius: 18px;
  border-width: 2px;
  box-shadow: 0 3px 0 #d4e3f5;
}
.card-badge {
  background: #1760dc;
  color: white;
  border: 2px solid white;
  border-radius: 9px;
  font-size: 11px;
}
.card-lock {
  color: #1760dc;
}
.card-content h3 {
  font-weight: 800;
}
progress,
.mini-progress progress {
  height: 9px;
}
.race-panel {
  border: 2px solid #d7c9f5;
  box-shadow: 0 5px 0 #dfd3f7;
  background: #f4efff;
}
.race-panel .primary {
  background: #7044ca;
  box-shadow: 0 4px 0 #4d2996;
}
.race-panel .segments button {
  background: white;
  font-weight: 800;
}
.segments button.active,
.race-panel .segments button.active {
  background: #1760dc;
  color: white;
  border-color: #1760dc;
}
.matching-art > svg {
  stroke: #174fbb;
  fill: #53afff;
}
.matching-art > svg:nth-child(2) {
  stroke: #b47000;
  fill: #ffcf36;
}
.tray-panel {
  border: 2px solid #b8d9f5;
  border-radius: 20px;
}
.board-viewport {
  border-radius: 20px;
  box-shadow: 0 5px 0 #b5d5f0;
}
.play-tools .soft-btn:first-child {
  background: #ffe178;
  color: #603d00;
}
.play-tools .soft-btn:nth-child(2) {
  background: #e4d7ff;
  color: #5735a0;
}
.filter-btn {
  font-weight: 750;
}
.piece.selected {
  border-width: 2px;
}
.shop-card {
  border-radius: 20px;
  border-width: 2px;
}
.shop-card.hint-pack {
  border-color: #efd061;
}
.shop-art .icon {
  stroke-width: 1.7;
}
.dialog {
  background: white;
  border: 3px solid #d9e9ff;
}
.result-stars {
  color: #e9a100;
  text-shadow: 0 2px 0 #ffe496;
}
.result-win,
.result-draw {
  border-color: #ffd34c;
}
.result-timeout,
.result-lose {
  border-color: #bba2ed;
}
.settings-panel {
  border-width: 2px;
  border-radius: 20px;
}

@media (min-width: 1500px) {
  .hero h1 {
    font-size: 75px;
  }
  .hero {
    min-height: 440px;
  }
  .main {
    padding-left: 65px;
    padding-right: 65px;
  }
  .puzzle-layout {
    grid-template-columns: minmax(0, 1fr) 300px;
  }
  .piece-tray {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
@media (max-width: 1150px) {
  .shell {
    grid-template-columns: 190px minmax(0, 1fr);
  }
  .sidebar {
    padding: 28px 14px;
  }
  .brand {
    font-size: 21px;
  }
  .brand-sub {
    margin-left: 0;
    text-align: center;
  }
  .main {
    padding: 0 26px 25px;
  }
  .hero h1 {
    font-size: 51px;
  }
  .hero p {
    font-size: 12px;
  }
  .mode-card {
    padding: 18px 14px;
    gap: 12px;
  }
  .mode-card h3 {
    font-size: 15px;
  }
  .mode-illustration {
    width: 42px;
    height: 51px;
  }
  .mode-illustration .icon {
    width: 27px;
  }
  .puzzle-grid {
    gap: 13px;
  }
  .puzzle-layout {
    grid-template-columns: minmax(0, 1fr) 210px;
    gap: 18px;
  }
  .shop-grid {
    gap: 13px;
  }
}
@media (max-width: 850px) {
  .shell {
    grid-template-columns: 76px minmax(0, 1fr);
  }
  .sidebar {
    padding: 24px 12px;
  }
  .brand span,
  .brand-sub,
  .nav button span,
  .sidebar-bottom,
  .nav .nav-label {
    display: none;
  }
  .nav {
    margin-top: 35px;
    gap: 15px;
  }
  .nav button {
    padding: 13px;
    justify-content: center;
  }
  .brand {
    justify-content: center;
  }
  .hero h1 {
    font-size: 47px;
  }
  .hero {
    min-height: 340px;
  }
  .mode-card p {
    font-size: 10px;
  }
  .puzzle-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .home-grid .puzzle-card:last-child {
    display: none;
  }
  .puzzle-layout {
    grid-template-columns: minmax(0, 1fr) 185px;
  }
  .piece-tray {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .shop-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .shop-card.hint-pack {
    grid-column: span 2;
  }
}
@media (max-width: 620px) {
  .shell {
    display: block;
  }
  .sidebar {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    height: auto;
    padding: 7px 12px calc(7px + env(safe-area-inset-bottom));
    border: 0;
    border-top: 1px solid var(--line);
    z-index: 20;
    background: #f2f8fffa;
  }
  .sidebar > .brand {
    display: none;
  }
  .nav {
    display: flex;
    margin: 0;
    gap: 5px;
    justify-content: space-around;
  }
  .nav button {
    flex-direction: column;
    gap: 4px;
    font-size: 9px;
    flex: 1;
    padding: 7px 2px;
    border-radius: 8px;
  }
  .nav button span {
    display: block;
    max-width: 85px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .nav .icon {
    width: 20px;
    height: 20px;
  }
  .main {
    padding: 0 20px 90px;
  }
  .topbar {
    height: 70px;
  }
  .mobile-brand {
    display: flex;
    font-size: 21px;
  }
  .mobile-brand img {
    width: 32px;
    height: 32px;
    border-radius: 10px;
  }
  .breadcrumb {
    display: none;
  }
  .top-actions {
    gap: 4px;
  }
  .top-actions > .avatar {
    display: none;
  }
  .coin-pill {
    padding: 5px 10px;
    font-size: 11px;
  }
  .language-small {
    font-size: 10px;
    padding: 6px 3px;
  }
  .page {
    padding-top: 20px;
  }
  .hero {
    display: flex;
    flex-direction: column;
    text-align: center;
    padding: 20px 14px 24px;
    gap: 8px;
  }
  .hero h1 {
    font-size: 42px;
    margin: 14px 0;
  }
  .hero .eyebrow {
    font-size: 8px;
  }
  .hero p {
    font-size: 12px;
    max-width: 290px;
    margin: 0 auto 20px;
  }
  .hero-caption {
    justify-content: center;
    font-size: 9px;
    gap: 14px;
    margin-top: 16px;
  }
  .hero-art {
    width: 260px;
    height: 235px;
    aspect-ratio: auto;
    order: -1;
    margin-bottom: 12px;
  }
  .hero-picture {
    width: 70%;
    border-width: 5px;
  }
  .hero-art .floating-piece {
    width: 28%;
    right: 2%;
    bottom: 0;
  }
  .art-note {
    font-size: 8px;
    padding: 6px 9px;
    top: 3%;
    right: 0;
  }
  .hero-spark {
    font-size: 27px;
  }
  .hero-dots {
    font-size: 20px;
  }
  .mode-cards {
    gap: 11px;
    margin-bottom: 29px;
    margin-top: 20px;
  }
  .mode-card {
    display: block;
    padding: 16px;
    position: relative;
    min-height: 163px;
  }
  .mode-illustration {
    width: 37px;
    height: 39px;
    border-radius: 10px;
    margin-bottom: 15px;
  }
  .mode-illustration .icon {
    width: 24px;
    height: 24px;
  }
  .mode-card h3 {
    font-size: 14px;
    line-height: 1.3;
  }
  .mode-card p {
    font-size: 10px;
  }
  .mode-card > .icon {
    position: absolute;
    top: 26px;
    right: 16px;
    width: 16px;
  }
  .section-heading h2 {
    font-size: 24px;
  }
  .section-heading .eyebrow {
    font-size: 8px;
  }
  .section-heading .text-btn {
    font-size: 10px;
    white-space: nowrap;
  }
  .section-heading .text-btn .icon {
    width: 13px;
  }
  .puzzle-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .home-grid .puzzle-card:last-child {
    display: block;
  }
  .card-content {
    padding: 11px;
  }
  .card-content h3 {
    font-size: 13px;
  }
  .card-meta {
    font-size: 8px;
  }
  .card-content .eyebrow {
    font-size: 7px;
  }
  .footer {
    margin-top: 25px;
    padding: 22px 0 5px;
    font-size: 9px;
    gap: 12px;
  }
  .footer span {
    max-width: 210px;
  }
  .collection-head h1,
  .standard-head h1 {
    font-size: 35px;
  }
  .standard-head p {
    font-size: 12px;
  }
  .filter {
    font-size: 10px;
    padding: 7px 12px;
  }
  .searchbox {
    max-width: none;
  }
  .game-heading {
    gap: 9px;
    margin-bottom: 18px;
  }
  .game-heading .icon-btn {
    width: 35px;
    height: 35px;
  }
  .game-heading h1 {
    font-size: 17px;
    max-width: 180px;
  }
  .game-heading .eyebrow {
    font-size: 8px;
  }
  .game-clock {
    font-size: 16px;
    gap: 5px;
  }
  .game-clock .icon {
    width: 14px;
  }
  .game-progress {
    margin-bottom: 17px;
  }
  .puzzle-layout {
    display: flex;
    flex-direction: column;
    gap: 17px;
  }
  .board-viewport {
    border-width: 6px;
  }
  .board-tools {
    margin-top: 10px;
  }
  .play-tools {
    margin: 14px 0 0;
    gap: 8px;
  }
  .play-tools .soft-btn {
    font-size: 11px;
    min-height: 40px;
    padding: 9px 13px;
  }
  .play-tools .icon-btn {
    width: 37px;
    height: 37px;
  }
  .play-tools .icon {
    width: 17px;
  }
  .game-help {
    font-size: 9px;
    margin: 11px auto 0;
  }
  .tray-panel {
    width: 100%;
    padding: 12px;
  }
  .piece-tray {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    max-height: 220px;
    gap: 2px;
  }
  .tray-title h2 {
    font-size: 14px;
  }
  .filter-btn {
    margin: 7px 0;
    font-size: 9px;
  }
  .tray-title .icon-btn {
    height: 24px;
  }
  .board-tools .saved-note {
    font-size: 8px;
  }
  .dialog {
    padding: 26px 22px;
    border-radius: 17px;
  }
  .dialog h2 {
    font-size: 26px;
  }
  .dialog-backdrop {
    padding: 13px;
  }
  .race-panel {
    padding: 27px 20px;
    margin: 10px 0;
  }
  .race-panel h2 {
    font-size: 29px;
  }
  .race-panel p {
    font-size: 12px;
  }
  .race-panel .segments {
    gap: 5px;
  }
  .race-panel .segments button {
    font-size: 10px;
    padding: 10px 6px;
  }
  .shop-grid {
    gap: 12px;
  }
  .shop-card {
    padding: 16px;
  }
  .shop-card.hint-pack {
    grid-template-columns: 85px 1fr;
    gap: 16px;
  }
  .shop-card h2 {
    font-size: 18px;
  }
  .shop-card p {
    font-size: 11px;
  }
  .shop-card .primary {
    font-size: 10px;
    padding: 10px;
  }
  .shop-art {
    height: 85px;
  }
  .shop-art .icon {
    width: 45px;
    height: 45px;
  }
  .settings-panel {
    padding: 5px 18px;
  }
  .setting-row {
    font-size: 12px;
  }
  .opponent {
    font-size: 10px;
    padding: 10px;
  }
  .matching-art {
    height: 150px;
  }
  .result-stats b {
    font-size: 18px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

@media (max-width: 620px) {
  .mobile-brand span {
    display: inline;
  }
  .mobile-brand {
    font-size: 18px;
    gap: 7px;
  }
  .game .board-viewport {
    max-width: min(100%, 34dvh);
  }
  .game-help {
    display: none;
  }
  .game .tray-panel {
    margin-top: 0;
  }
  .game .piece-tray {
    max-height: 180px;
  }
  .game .play-tools {
    margin-top: 12px;
  }
}
@media (min-width: 621px) {
  .game .board-viewport {
    max-width: 520px;
  }
}
.result-win .result-art {
  animation: celebrate 0.7s ease-out;
}
.result-lose .result-art {
  animation: regroup 0.65s ease-in-out;
}
.result-timeout .result-art {
  animation: regroup 0.65s ease-in-out;
}
.result-draw .result-art {
  animation: celebrate 0.7s ease-out;
}
@keyframes celebrate {
  0% {
    transform: scale(0.5) rotate(-20deg);
    opacity: 0;
  }
  65% {
    transform: scale(1.08) rotate(3deg);
  }
  100% {
    transform: scale(1) rotate(-6deg);
    opacity: 1;
  }
}
@keyframes regroup {
  0%,
  100% {
    transform: rotate(-6deg);
  }
  30% {
    transform: rotate(8deg);
  }
  70% {
    transform: rotate(-13deg);
  }
}
/* Experience 1.2: bright controls, clear choices and expressive result scenes. */
.hero {
  background: #d83038;
}
.hero-new {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 14px;
  padding: 10px 0;
  color: #fff;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 4px;
}
.music-toggle {
  font-weight: 800;
  font-size: 12px;
  color: #184488;
  background: #e8f3ff;
  border: 1px solid #bddbff;
  border-radius: 20px;
  padding: 8px 11px;
  white-space: nowrap;
}
.change-pieces-button {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 16px;
  padding: 9px 15px;
  border-radius: 12px;
  color: #174da9;
  background: #fff;
  border: 2px solid #87baff;
  font-weight: 800;
}
.setup-dialog {
  max-width: 540px;
}
.setup-heading {
  display: flex;
  align-items: center;
  gap: 20px;
}
.setup-heading img {
  width: 92px;
  height: 92px;
  object-fit: cover;
  border-radius: 17px;
  transform: rotate(-4deg);
}
.setup-heading h2 {
  margin: 5px 0;
  font-size: 27px;
}
.setup-heading p {
  margin: 4px 0;
  font-size: 13px;
}
.piece-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  margin: 20px 0;
}
.piece-options button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 84px;
  border: 2px solid #d9e8fa;
  border-radius: 15px;
  background: #f2f8ff;
  color: #204674;
  position: relative;
}
.piece-options strong {
  font-size: 26px;
  line-height: 1.1;
}
.piece-options span {
  font-size: 11px;
}
.piece-options small {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.5px;
}
.piece-options button.active {
  background: #1760dc;
  color: #fff;
  border-color: #1760dc;
  box-shadow: 0 4px 0 #103e96;
}
.piece-options button:hover {
  border-color: #1760dc;
}
.restart-notice {
  background: #fff5ce;
  border-radius: 12px;
  padding: 13px;
  font-size: 12px;
  line-height: 1.5;
  color: #67501c;
}
.shop-explainer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 24px 0;
}
.shop-explainer > div {
  background: #edf5ff;
  border: 1px solid #c8defa;
  border-radius: 18px;
  padding: 20px;
}
.shop-explainer strong {
  display: block;
  font-size: 18px;
  margin-top: 8px;
}
.shop-explainer p {
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 0;
  color: var(--muted);
}
.shop-explainer svg {
  color: #1760dc;
  width: 29px;
  height: 29px;
}
.shop-board {
  display: block;
  width: 100%;
  height: auto;
}
.shop-preview-button {
  padding: 0;
  width: 100%;
  border-radius: 17px;
  overflow: hidden;
  cursor: zoom-in;
}
.shop-card {
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.shop-card > button:last-child {
  margin-top: auto;
}
.shop-card > p {
  font-size: 13px;
  line-height: 1.5;
  margin: 0 0 8px;
  color: var(--muted);
}
.shop-card h2 {
  margin: 2px 0;
}
.shop-card .eyebrow {
  margin-top: 10px;
}
.shop-card.hint-pack {
  display: flex;
  grid-column: auto;
}
.hint-pack .shop-art {
  background: #ffe178;
  color: #765309;
  min-height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
}
.hint-pack .shop-art strong {
  font-size: 36px;
}
.shop-balance small {
  font-size: 14px;
}
.inventory {
  background: #f0f5ff;
  padding: 8px;
  border-radius: 9px;
  font-size: 13px;
}
.theme-preview {
  max-width: 300px;
  margin: 20px auto;
}
.reward-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  text-align: left;
  background: #fff5ce;
  border: 2px solid #ffdf5e;
  border-radius: 18px;
  padding: 24px;
  margin: 24px 0;
}
.reward-panel h2 {
  margin: 4px 0;
  font-size: 24px;
}
.reward-panel p {
  max-width: 550px;
  margin-bottom: 0;
  line-height: 1.6;
}
.reward-panel .primary {
  flex-shrink: 0;
}
.reward-panel .eyebrow {
  color: #785816;
}
.shop-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.outcome-scene {
  height: 144px;
  width: 210px;
  margin: 0 auto;
  position: relative;
  display: grid;
  place-items: center;
  isolation: isolate;
}
.scene-badge {
  background: #ffdf5e;
  color: #9b5e00;
  width: 84px;
  height: 84px;
  display: grid;
  place-items: center;
  border: 5px solid #fff;
  border-radius: 26px;
  box-shadow: 0 7px 0 #e9ad16;
  z-index: 2;
  animation: badge-arrive 0.8s cubic-bezier(0.2, 1.5, 0.4, 1) both;
}
.scene-badge svg {
  width: 48px;
  height: 48px;
  stroke-width: 2.5;
}
.scene-ring {
  position: absolute;
  border: 2px solid #ffdf5e;
  border-radius: 50%;
  width: 118px;
  height: 118px;
  animation: ring-expand 1.8s ease-out both;
}
.ring-two {
  animation-delay: 0.2s;
}
.scene-spark {
  position: absolute;
  left: 100px;
  top: 60px;
  color: #1760dc;
  font-size: 20px;
  --angle: calc(var(--i) * 45deg);
  animation: spark-burst 1.5s 0.2s both;
}
.scene-spark:nth-of-type(3n) {
  color: #e33c3c;
}
.scene-piece {
  position: absolute;
  top: 64px;
  color: #1760dc;
  z-index: 3;
}
.scene-piece svg {
  width: 34px;
  height: 34px;
  stroke-width: 2.3;
}
.scene-piece.left {
  left: 22px;
  animation: piece-left 1s both;
}
.scene-piece.right {
  right: 22px;
  color: #e33c3c;
  animation: piece-right 1s both;
}
.scene-lose .scene-badge {
  background: #ffdfeb;
  color: #c02b62;
  box-shadow: 0 7px 0 #ee93b2;
  animation: heart-lift 1.2s both;
}
.scene-timeout .scene-badge {
  background: #d8eeff;
  color: #1760dc;
  box-shadow: 0 7px 0 #89baff;
  animation: clock-sway 1.2s both;
}
.scene-draw .scene-badge {
  background: #d9ccff;
  color: #673dc1;
  box-shadow: 0 7px 0 #af93ef;
}
.result-dialog .result-art {
  height: 100px;
  width: 100px;
  border-radius: 15px;
  margin: 0 auto 8px;
  object-fit: cover;
  display: block;
}
.result-dialog h2 {
  font-size: 29px;
  margin: 12px 0;
}
.result-stars {
  animation: stars-pop 0.6s 0.45s both;
}
.result-dialog {
  overflow: hidden;
}
.matching-art {
  position: relative;
  background: #e8f3ff;
  border: 3px dashed #93bbf4;
  border-radius: 50%;
  width: 160px;
  height: 160px;
  margin: 0 auto 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}
.matching-art svg {
  width: 58px;
  height: 58px;
  animation: search-piece 1.9s ease-in-out infinite;
}
.matching-art svg:first-child {
  color: #1760dc;
}
.matching-art svg:last-child {
  color: #ed4244;
  animation-delay: 0.3s;
}
@keyframes badge-arrive {
  from {
    transform: translateY(35px) scale(0.4) rotate(-25deg);
    opacity: 0;
  }
  70% {
    transform: translateY(-5px) scale(1.1) rotate(8deg);
  }
  to {
    transform: none;
    opacity: 1;
  }
}
@keyframes ring-expand {
  from {
    transform: scale(0.3);
    opacity: 1;
  }
  to {
    transform: scale(1.35);
    opacity: 0;
  }
}
@keyframes spark-burst {
  from {
    transform: rotate(var(--angle)) translateX(20px) scale(0);
    opacity: 0;
  }
  40% {
    opacity: 1;
  }
  to {
    transform: rotate(var(--angle)) translateX(82px)
      rotate(calc(-1 * var(--angle))) scale(0.6);
    opacity: 0;
  }
}
@keyframes piece-left {
  from {
    transform: translate(-28px, 22px) rotate(-60deg);
    opacity: 0;
  }
  to {
    transform: rotate(-18deg);
    opacity: 1;
  }
}
@keyframes piece-right {
  from {
    transform: translate(28px, 22px) rotate(60deg);
    opacity: 0;
  }
  to {
    transform: rotate(18deg);
    opacity: 1;
  }
}
@keyframes heart-lift {
  0% {
    transform: translateY(22px) scale(0.6);
    opacity: 0;
  }
  45% {
    transform: translateY(-8px) scale(1.06);
  }
  75% {
    transform: scale(0.94);
  }
  100% {
    transform: none;
    opacity: 1;
  }
}
@keyframes clock-sway {
  0% {
    transform: scale(0.4);
    opacity: 0;
  }
  35% {
    transform: rotate(-18deg);
  }
  55% {
    transform: rotate(15deg);
  }
  75% {
    transform: rotate(-8deg);
  }
  100% {
    transform: none;
    opacity: 1;
  }
}
@keyframes stars-pop {
  from {
    transform: scale(0.3);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}
@keyframes search-piece {
  0%,
  100% {
    transform: translateY(-10px) rotate(-15deg);
  }
  50% {
    transform: translateY(10px) rotate(15deg);
  }
}
@media (max-width: 900px) {
  .shop-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .reward-panel {
    align-items: stretch;
    flex-direction: column;
  }
  .reward-panel .primary {
    width: 100%;
  }
}
@media (max-width: 620px) {
  .music-toggle {
    font-size: 0;
    width: 32px;
    padding: 7px;
  }
  .music-toggle::before {
    content: "♫";
    font-size: 16px;
  }
  .music-toggle[aria-pressed="false"] {
    opacity: 0.55;
  }
  .top-actions {
    gap: 6px;
  }
  .shop-explainer {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .shop-explainer > div {
    padding: 16px;
  }
  .shop-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .shop-card {
    padding: 13px;
  }
  .shop-card h2 {
    font-size: 19px;
  }
  .shop-card .primary,
  .shop-card .secondary {
    font-size: 12px;
    padding: 11px 6px;
    gap: 4px;
  }
  .setup-heading {
    gap: 13px;
  }
  .setup-heading img {
    width: 70px;
    height: 70px;
  }
  .setup-heading h2 {
    font-size: 24px;
  }
  .setup-dialog {
    padding: 24px 20px;
  }
  .outcome-scene {
    height: 120px;
  }
  .result-dialog .result-art {
    width: 75px;
    height: 75px;
  }
  .result-dialog h2 {
    font-size: 25px;
  }
  .change-pieces-button {
    font-size: 13px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .outcome-scene *,
  .result-stars,
  .matching-art svg {
    animation: none !important;
  }
  .scene-ring,
  .scene-spark {
    display: none;
  }
}
.no-motion .outcome-scene *,
.no-motion .result-stars,
.no-motion .matching-art svg {
  animation: none !important;
}
.no-motion .scene-ring,
.no-motion .scene-spark {
  display: none;
}

.credit-photo {
  display: flex;
  gap: 18px;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.credit-photo img {
  flex: none;
  object-fit: cover;
  border-radius: 14px;
}
.credit-photo h3 {
  margin: 0;
  font-size: 16px;
}
.credit-photo p {
  font-size: 13px;
  margin: 6px 0;
}
.hero h1,
.hero p,
.hero .eyebrow,
.hero-caption,
.hero-caption .icon {
  color: #fff;
}
.hero .primary {
  background: #ffcf32;
  color: #153367;
  border-color: #ffcf32;
  box-shadow: 0 4px 0 #a9252e;
}
.hero .primary:hover {
  background: #ffe16b;
  color: #153367;
}
/* The play surface owns the viewport. Tray scrolling never moves the board. */
@media (max-width: 900px), (max-height: 620px) {
  body.playing {
    height: 100dvh;
    overflow: hidden;
    overscroll-behavior: none;
  }
  .playing .sidebar,
  .playing .topbar,
  .playing .footer {
    display: none;
  }
  .playing .shell {
    display: block;
    height: 100dvh;
    min-height: 0;
  }
  .playing .main {
    padding: max(8px, env(safe-area-inset-top)) 10px
      max(8px, env(safe-area-inset-bottom));
    height: 100%;
    max-width: 100%;
  }
  .playing .page {
    height: 100%;
    padding: 0;
    min-height: 0;
  }
  .playing .game {
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
  .playing .game-heading {
    margin: 0;
    gap: 8px;
    flex: none;
    min-height: 40px;
  }
  .playing .game-heading h1 {
    font-size: 16px;
    margin: 2px 0 0;
    max-width: 180px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .playing .game-heading .icon-btn {
    width: 40px;
    height: 40px;
  }
  .playing .change-pieces-button {
    margin: 0;
    padding: 4px 8px;
    align-self: flex-start;
    font-size: 12px;
    min-height: 28px;
  }
  .playing .game-progress {
    margin: 0;
    flex: none;
  }
  .playing .game-progress > div {
    margin-bottom: 3px;
  }
  .playing .opponent {
    margin: 0;
    padding: 3px 8px;
    flex: none;
    font-size: 11px;
  }
  .playing .online-state {
    margin: 0;
    font-size: 11px;
    flex: none;
  }
  .playing .puzzle-layout {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    min-height: 0;
  }
  .playing .board-column {
    display: contents;
  }
  .playing .board-viewport {
    order: 0;
    flex: none;
    width: min(100%, calc(100dvh - 340px));
    max-width: none;
    border-width: 4px;
    margin: 0 auto;
  }
  .playing .tray-panel {
    order: 1;
    width: 100%;
    padding: 6px;
    margin: 0;
    align-self: stretch;
    min-height: 110px;
    flex: 1;
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: 28px minmax(0, 1fr);
    gap: 3px 8px;
  }
  .playing .tray-title {
    gap: 5px;
  }
  .playing .tray-title h2 {
    font-size: 12px;
  }
  .playing .filter-btn {
    width: auto;
    margin: 0;
    padding: 4px 8px;
    font-size: 10px;
  }
  .playing .piece-tray {
    grid-column: 1/-1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(58px, 1fr));
    grid-auto-rows: 64px;
    align-content: start;
    gap: 3px;
    max-height: none;
    min-height: 0;
    overflow: auto;
  }
  .playing .piece {
    width: 64px;
    max-width: 100%;
    height: 64px;
    justify-self: center;
  }
  .playing #tray-empty {
    grid-column: 1/-1;
    margin: 0;
    padding: 0;
  }
  .playing .board-tools {
    order: 2;
    margin: 0;
    flex: none;
    justify-content: center;
  }
  .playing .board-tools .saved-note {
    display: none;
  }
  .playing .play-tools {
    order: 3;
    margin: 0;
    flex: none;
    gap: 8px;
  }
  .playing .play-tools .soft-btn {
    min-height: 38px;
    padding: 6px 12px;
  }
  .playing .play-tools .icon-btn {
    width: 38px;
    height: 38px;
  }
  .playing .game-help {
    display: none;
  }
}
@media (max-height: 520px) and (orientation: landscape) {
  .playing .game {
    gap: 3px;
  }
  .playing .game-heading {
    min-height: 34px;
  }
  .playing .game-progress,
  .playing .change-pieces-button {
    display: none;
  }
  .playing .puzzle-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(180px, 1fr);
    grid-template-rows: minmax(0, 1fr) 38px;
    gap: 5px 10px;
  }
  .playing .board-viewport {
    grid-column: 1;
    grid-row: 1;
    width: min(100%, calc(100dvh - 116px));
  }
  .playing .tray-panel {
    grid-column: 2;
    grid-row: 1;
  }
  .playing .board-tools {
    grid-column: 1;
    grid-row: 2;
  }
  .playing .play-tools {
    grid-column: 2;
    grid-row: 2;
  }
}
.paid-collections {
  margin: 24px 0 36px;
  padding: 24px;
  background: #e4f1ff;
  border: 2px solid #b7d8ff;
  border-radius: 24px;
}
.paid-collections .standard-head {
  margin-bottom: 18px;
}
.paid-collections .shop-card {
  background: #fff;
}
.mini-cover {
  aspect-ratio: 1;
  border-radius: 16px;
  overflow: hidden;
}
.mini-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.mini-previews {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 12px 0;
}
.mini-previews button {
  padding: 0;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid transparent;
  aspect-ratio: 1;
}
.mini-previews button:not(:disabled):hover {
  border-color: var(--accent);
}
.mini-previews button:disabled {
  opacity: 1;
}
.mini-previews img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.paid-collections > .secondary {
  margin-top: 18px;
}
@media (max-width: 600px) {
  .paid-collections {
    padding: 14px;
  }
}
.tray-pages {
  display: flex;
  align-items: center;
  gap: 1px;
  margin-left: auto;
  font-size: 11px;
  white-space: nowrap;
}
.tray-pages .icon-btn {
  width: 32px;
  height: 32px;
  font-size: 25px;
}
.tray-title {
  gap: 4px;
}
@media (max-width: 900px), (max-height: 620px) {
  .playing .tray-panel {
    grid-template-rows: 34px minmax(0, 1fr);
  }
  .playing .piece-tray {
    overflow: hidden;
  }
  .playing .tray-title h2 {
    font-size: 11px;
    white-space: nowrap;
  }
  .playing #shuffle {
    width: 28px;
    height: 32px;
  }
  .playing .tray-pages {
    margin-left: auto;
  }
}
.paid-collections .shop-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr));
}
@media (max-width: 900px), (max-height: 620px) {
  .playing .piece-tray {
    grid-auto-rows: 62px;
  }
  .playing .piece {
    width: 62px;
    height: 62px;
  }
}

@media (max-width: 900px), (max-height: 620px) {
  .playing .game:has(.opponent) .board-viewport {
    width: min(100%, calc(100dvh - 400px));
  }
}
@media (max-height: 520px) and (orientation: landscape) {
  .playing .game:has(.opponent) .board-viewport {
    width: min(100%, calc(100dvh - 170px));
  }
}
