@font-face {
  font-family: Bricolage;
  src: url("assets/bricolage.woff2") format("woff2");
  font-weight: 400 800;
  font-display: swap;
}

@font-face {
  font-family: DM Sans;
  src: url("assets/dm-sans.woff2") format("woff2");
  font-weight: 400 800;
  font-display: swap;
}

:root {
  color-scheme: light;
  -webkit-font-smoothing: antialiased;
  --page: #f7f0fb;
  --ink: #2b2049;
  --muted: #5b4d74;
  --accent: #5b36c5;
  --on-accent: #fff;
  --focus: #522bb1;
  --surface: #fffbff;
  --edge: #dfd0ed;
  --control-edge: #aa99c7;
  --tint: color-mix(in srgb, var(--accent) 10%, var(--surface));
  --hover: color-mix(in srgb, var(--accent) 16%, var(--surface));
  --accent-hover: color-mix(in srgb, var(--accent) 83%, var(--ink));
  --heat-text: #772749;
  --ice-text: #195571;
  --ready-bg: #fff0f5;
  --ready-bg-hover: #ffe3ee;
  --ready-border: #a13d5d;
  --ready-text: #73233e;
  --ready-pill-bg: #f2c2d3;
  --ready-pill-text: #67253f;
  --turn-active-bg: #852e50;
  --turn-active-border: #6b2540;
  --mode-group-ink: #6640aa;
  --mode-group-bg: #eaddff;
  --mode-line-ink: #177456;
  --mode-line-bg: #d8f4e6;
  --mode-special-ink: #a23d5f;
  --mode-special-bg: #ffe2ec;
  --star-gold: #d98a00;
  --star-empty: #cbbce0;
  --backdrop: rgb(46 26 88 / .44);
  --elev: 0 2px 8px rgb(43 32 73 / .06), 0 1px 2px rgb(43 32 73 / .04);
  --world-floor: #dcdfff;
  --stage-light: #faf0ff;
  --stage: #e5d5f6;
  --stage-alt: #ead6ee;
  --stage-edge: #c7addf;
  --deck: #c4a8eb;
  --deck-edge: #9a7dc3;
  --deck-depth: #9277be;
  --deck-rim: #dfd0f8;
  --deck-shadow: 22px 28px 42px rgb(34 22 60 / .24), 8px 10px 16px rgb(34 22 60 / .16);
  --pedestal-top: #f2e8ff;
  --pedestal-edge: #baa0df;
  --pedestal-side: #9e81c9;
  --banner-bg: #241742;
  --banner-ink: #fff8ff;
  --banner-accent: #ffd15c;
  --display: Bricolage, system-ui, sans-serif;
  --body: DM Sans, system-ui, sans-serif;
  font: 500 1rem/1.5 var(--body);
  color: var(--ink);
  background: var(--page);
}
:root[data-theme="dusk"] {
  --page: #fff1e5;
  --ink: #45231c;
  --muted: #68463c;
  --accent: #a23e2d;
  --focus: #8d2f21;
  --surface: #fffaf2;
  --edge: #efd1bd;
  --control-edge: #c39a84;
  --heat-text: #8c2642;
  --ice-text: #195571;
  --ready-bg: #fff0ea;
  --ready-bg-hover: #ffe1d6;
  --ready-border: #a84231;
  --ready-text: #7b271a;
  --ready-pill-bg: #f6c8b7;
  --ready-pill-text: #6e2217;
  --turn-active-bg: #913022;
  --turn-active-border: #6f2014;
  --mode-group-ink: #8a3525;
  --mode-group-bg: #fce2d5;
  --mode-line-ink: #1e6c54;
  --mode-line-bg: #daf2e5;
  --mode-special-ink: #8f4700;
  --mode-special-bg: #ffebc7;
  --star-gold: #c97800;
  --star-empty: #e1c0ad;
  --backdrop: rgb(69 35 28 / .44);
  --elev: 0 2px 8px rgb(69 35 28 / .07), 0 1px 2px rgb(69 35 28 / .04);
  --world-floor: #ffe0b4;
  --stage-light: #fff2df;
  --stage: #f4d5bd;
  --stage-alt: #f1c3ba;
  --stage-edge: #dbad99;
  --deck: #e2ac94;
  --deck-edge: #b27361;
  --deck-depth: #b87965;
  --deck-rim: #f7d7bf;
  --deck-shadow: 22px 28px 42px rgb(68 30 18 / .24), 8px 10px 16px rgb(68 30 18 / .15);
  --pedestal-top: #ffeedd;
  --pedestal-edge: #d8a28b;
  --pedestal-side: #ba7f68;
  --banner-bg: #3b1c15;
  --banner-ink: #fff7ef;
  --banner-accent: #ffd06b;
}
:root[data-theme="night"] {
  color-scheme: dark;
  --page: #130d25;
  --ink: #f8edff;
  --muted: #d0bddd;
  --accent: #c5a6ff;
  --on-accent: #251439;
  --focus: #e6d3ff;
  --surface: #251a39;
  --edge: #4c3a64;
  --control-edge: #806698;
  --heat-text: #ffacce;
  --ice-text: #aeebff;
  --ready-bg: #461e36;
  --ready-bg-hover: #582644;
  --ready-border: #d96b97;
  --ready-text: #ffd4e5;
  --ready-pill-bg: #6b2b50;
  --ready-pill-text: #ffe4ef;
  --turn-active-bg: #c94b7d;
  --turn-active-border: #f08ab2;
  --mode-group-ink: #d9c2ff;
  --mode-group-bg: #3b295e;
  --mode-line-ink: #97ebd0;
  --mode-line-bg: #1e423b;
  --mode-special-ink: #ffadd0;
  --mode-special-bg: #4b223a;
  --star-gold: #ffd059;
  --star-empty: #5a4674;
  --backdrop: rgb(9 5 20 / .68);
  --elev: 0 4px 14px rgb(5 2 14 / .36), 0 1px 2px rgb(5 2 14 / .24);
  --world-floor: #1e3357;
  --stage-light: #3b2a56;
  --stage: #2b1f45;
  --stage-alt: #312448;
  --stage-edge: #675184;
  --deck: #5b477c;
  --deck-edge: #9078b4;
  --deck-depth: #38264f;
  --deck-rim: #705a94;
  --deck-shadow: 24px 32px 48px rgb(6 2 16 / .62), 8px 12px 18px rgb(6 2 16 / .42);
  --pedestal-top: #4a386b;
  --pedestal-edge: #836ca8;
  --pedestal-side: #2b1d42;
  --banner-bg: #f6ebff;
  --banner-ink: #22123d;
  --banner-accent: #7a3df0;
}

[hidden] { display: none !important; }

*, *::before, *::after { box-sizing: border-box; }
body {
  position: relative;
  isolation: isolate;
  min-height: 100svh;
  min-width: 0;
  margin: 0;
  background: linear-gradient(145deg, var(--page) 42%, var(--world-floor));
}
::selection { color: var(--on-accent); background: var(--accent); }
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
button, a { -webkit-tap-highlight-color: transparent; }
h1, h2, h3 { text-wrap: balance; }
h1, h2, p { margin: 0; }
.shell {
  width: min(calc(100% - 32px), 1040px, max(640px, calc(152svh - 385px)));
  margin-inline: auto;
  padding-block-start: 10px;
}
.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  min-height: 60px;
  padding: 7px 11px;
  border: 1px solid var(--edge);
  border-radius: 19px;
  background: var(--surface);
  box-shadow: var(--elev);
  gap: 10px;
}
body[data-screen="menu"] .shell { width: min(calc(100% - 32px), 1056px); }
body[data-screen="menu"] .topbar {
  grid-template-columns: 1fr auto;
  padding-inline: 10px;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}
.menu-home { justify-self: start; }
.menu-home .back-mark {
  width: 8px;
  height: 8px;
  border-bottom: 2px solid currentColor;
  border-left: 2px solid currentColor;
  transform: rotate(45deg);
}
.brand-mark {
  display: grid;
  place-items: center;
  flex: none;
  width: 33px;
  height: 33px;
  border-radius: 10px;
  background: linear-gradient(145deg, #9973fa, #6a40d6);
  border: 1px solid #6d43ce;
  transform: rotate(-8deg);
}
.brand-mark span {
  position: relative;
  width: 15px;
  height: 9px;
  border-radius: 2px 2px 8px 8px;
  background: white;
  margin-top: 6px;
}
.brand-mark span::before {
  content: "";
  position: absolute;
  width: 3px;
  height: 3px;
  background: white;
  border-radius: 50%;
  top: -5px;
  left: 2px;
  box-shadow: 8px 0 white;
}
.top-actions { display: flex; justify-self: end; align-items: center; gap: 5px; }
.top-actions .quiet-button { border-color: var(--edge); background: var(--tint); }
.top-actions .quiet-button:hover { border-color: var(--control-edge); background: var(--hover); }
.top-actions .sound-button,
.top-actions .theme-button { padding: 0; }
.top-actions .sound-button[aria-pressed="true"] { color: var(--accent); border-color: var(--control-edge); background: var(--hover); }
.help-button { white-space: nowrap; }
.quiet-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  min-width: 44px;
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid var(--control-edge);
  border-radius: 12px;
  background: var(--surface);
  font-size: .875rem;
  font-weight: 750;
  transition: background-color 140ms, border-color 140ms, transform 140ms;
}
.quiet-button:hover { background: var(--hover); border-color: var(--accent); }
.quiet-button:enabled:active, .primary-button:enabled:active,
.turn-button:enabled:active, .view-switch button:active { transform: translateY(1px) scale(.96); }
.help-mark {
  display: grid;
  place-items: center;
  width: 17px;
  height: 17px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  font-size: .7rem;
  line-height: 1;
}
.sound-mark { position: relative; width: 18px; height: 18px; }
.sound-mark::before, .sound-mark::after { content: ""; position: absolute; }
.sound-mark::before {
  inset: 2px 6px 2px 0;
  background: currentColor;
  clip-path: polygon(0 32%, 42% 32%, 100% 0, 100% 100%, 42% 68%, 0 68%);
}
.sound-mark::after {
  inset: 3px 0 3px 7px;
  border-right: 1.5px solid currentColor;
  border-radius: 50%;
}
.sound-button[aria-pressed="false"] .sound-mark::after {
  inset: 8px -1px auto 7px;
  height: 2px;
  border: 0;
  border-radius: 2px;
  background: currentColor;
  transform: rotate(-49deg);
}

.game { padding-block: 10px 16px; }
.main-menu {
  display: grid;
  grid-template-columns: minmax(340px, 1.08fr) minmax(0, .92fr);
  align-items: center;
  gap: clamp(22px, 3.6vw, 48px);
  padding-block: clamp(18px, 4.5svh, 52px);
}
.menu-copy { min-width: 0; padding-inline-start: clamp(4px, 2vw, 22px); }
.menu-copy h1 {
  font: 800 clamp(3.9rem, 7.6vw, 5.7rem)/.82 var(--display);
  letter-spacing: -.033em;
}
.menu-copy h1 span { display: block; color: var(--accent); }
.mode-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-flow: dense;
  gap: 10px;
  max-width: 520px;
  margin-top: clamp(16px, 2.8vw, 26px);
}
.mode-option {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
  border: 1px solid var(--control-edge);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--elev);
  transition: background-color 140ms ease, border-color 140ms ease;
}
.mode-option-featured {
  grid-column: 1 / -1;
  border-color: color-mix(in srgb, var(--accent) 40%, var(--control-edge));
  background: linear-gradient(135deg, var(--surface) 54%, color-mix(in srgb, var(--mode-special-bg) 68%, var(--surface)));
}
.mode-button {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  flex: 1;
  padding: 13px 14px;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: 15px;
  text-align: start;
  transition: transform 140ms ease;
}
.mode-button:focus-visible { outline-offset: -3px; }
.mode-option:not(.mode-option-featured) .mode-button {
  grid-template-columns: 38px minmax(0, 1fr) auto;
  grid-template-rows: auto 1fr;
  align-items: start;
  align-content: start;
  gap: 10px 8px;
  padding: 13px;
}
.mode-option:not(.mode-option-featured) .mode-icon {
  width: 38px;
}
.mode-option:not(.mode-option-featured) .mode-arrow {
  grid-column: 3;
  grid-row: 1;
  align-self: center;
}
.mode-option:not(.mode-option-featured) .mode-copy {
  grid-column: 1 / -1;
  grid-row: 2;
}
@media (hover: hover) {
  .mode-option:has(.mode-button:hover) { background: var(--tint); border-color: var(--accent); }
  .mode-option-featured:has(.mode-button:hover) {
    background: linear-gradient(135deg, var(--tint) 50%, color-mix(in srgb, var(--mode-special-bg) 82%, var(--surface)));
    border-color: var(--accent);
  }
  .mode-button:hover .mode-arrow { transform: translateX(3px); }
}
.mode-button:active { transform: scale(.97); }
.mode-copy { display: grid; gap: 3px; color: var(--muted); font-size: .84rem; line-height: 1.32; }
.mode-copy strong { color: var(--ink); font: 800 1.16rem/1.14 var(--display); }
.mode-option-featured .mode-copy strong { font-size: 1.22rem; }
.mode-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 9px; margin-top: 3px; }
.mode-copy .mode-progress { color: var(--accent); font-size: .78rem; font-weight: 800; }
.mode-stars {
  color: var(--star-gold);
  font-size: .76rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.mode-arrow { color: var(--accent); font-size: 1.15rem; transition: transform 140ms ease; }
.mode-icon {
  display: grid;
  place-content: center;
  border-radius: 10px;
  width: 44px;
  aspect-ratio: 1;
  gap: 2px;
}
.mode-icon i { width: 8px; height: 8px; border-radius: 2px; background: currentColor; }
.mode-icon-group {
  grid-template-columns: repeat(2, 8px);
  color: var(--mode-group-ink);
  background: var(--mode-group-bg);
}
.mode-icon-group i:first-child { grid-column: span 2; }
.mode-icon-line {
  grid-template-columns: repeat(3, 8px);
  color: var(--mode-line-ink);
  background: var(--mode-line-bg);
}
.mode-icon-special {
  grid-template-columns: repeat(2, 8px);
  gap: 3px;
  color: var(--mode-special-ink);
  background: var(--mode-special-bg);
}
.mode-icon-special i:nth-child(2),
.mode-icon-special i:nth-child(3) {
  opacity: .72;
}
.mode-option > .mode-reset {
  display: flex;
  justify-content: flex-end;
  width: 100%;
  min-height: 38px;
  padding: 0 12px;
  border: 0;
  border-top: 1px solid var(--edge);
  border-radius: 0 0 15px 15px;
  background: color-mix(in srgb, var(--tint) 65%, transparent);
  color: var(--muted);
  font-size: .79rem;
}
.mode-option > .mode-reset:hover { color: var(--ink); background: var(--hover); }
.mode-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  border-top: 1px solid var(--edge);
  border-radius: 0 0 15px 15px;
  background: color-mix(in srgb, var(--tint) 65%, transparent);
}
.mode-links .quiet-button {
  min-height: 36px;
  padding-inline: 9px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  font-size: .79rem;
}
.mode-links .quiet-button:hover {
  border-color: var(--control-edge);
  background: var(--surface);
  color: var(--ink);
}
.mode-links .mode-reset { margin-top: 0; }
.menu-options { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.menu-options .quiet-button { border-color: var(--edge); }
.theme-mark {
  width: 17px;
  height: 17px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  background: linear-gradient(135deg, currentColor 50%, transparent 50%);
}
.menu-art {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  min-height: clamp(300px, 54svh, 480px);
  border: 1px solid var(--stage-edge);
  border-radius: 22px;
  overflow: clip;
  background:
    radial-gradient(color-mix(in srgb, var(--accent) 22%, transparent) 1px, transparent 1.5px) 0 0 / 18px 18px,
    radial-gradient(ellipse at 50% 43%, var(--stage-light), var(--stage-alt) 82%);
}
.menu-art::before {
  content: "";
  position: absolute;
  width: 78%;
  aspect-ratio: 1;
  border: 1px solid color-mix(in srgb, var(--accent) 32%, transparent);
  border-radius: 14%;
  transform: rotateX(52deg) rotateZ(45deg);
}
.menu-tray {
  --emoji-stretch: 1.31;
  position: relative;
  isolation: isolate;
  width: min(65%, 355px);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(4px, 1vw, 9px);
  transform: rotateX(46deg) rotateZ(45deg);
}
.menu-tray::before,
.menu-tray::after {
  content: "";
  position: absolute;
  inset: -3.5%;
  z-index: -1;
  border: 1px solid var(--deck-edge);
  border-radius: 14px;
  background: var(--deck);
}
.menu-tray::after {
  z-index: -2;
  background: var(--deck-depth);
  transform: translate(3%, 3%);
  box-shadow: 9px 9px 23px rgb(0 0 0 / .32);
}
.menu-tile { position: relative; aspect-ratio: 1; cursor: pointer; }
@media (hover: hover) {
  .menu-tile .tile { transition: transform 150ms ease; }
  .menu-tile:hover .tile { transform: translate(-4%, -4%) scale(1.04); }
}

.field-top {
  display: grid;
  grid-template-columns: minmax(0, .95fr) minmax(126px, 1fr) auto auto;
  grid-template-areas: "level score moves next";
  align-items: center;
  gap: 8px clamp(10px, 2.2vw, 24px);
  min-height: 54px;
  padding: 7px 12px;
  border: 1px solid var(--edge);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--elev);
}
.level-title { grid-area: level; }
.target { grid-area: score; min-width: 0; }
.next-preview {
  grid-area: next;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 0;
  color: var(--muted);
  font-size: .875rem;
  font-weight: 750;
}
.next-preview:not([hidden]) { display: flex; }
.queue-shift { padding-inline: 6px; }
.queue-shift:disabled { opacity: .5; }
.next-list { display: flex; align-items: center; gap: 4px; list-style: none; padding: 0; margin: 0; }
.next-item { width: 29px; aspect-ratio: 1; position: relative; flex: none; }
.next-item:first-child { width: 35px; }
.next-item .tile { display: block; cursor: inherit; pointer-events: none; }
.next-item .expression { animation: none; }
.target-head, .stat {
  display: flex;
  align-items: baseline;
  gap: 5px;
  color: var(--muted);
  font-size: .875rem;
  font-weight: 700;
}
.target-head { justify-content: space-between; flex-wrap: wrap; }
.objectives {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ink);
  font-size: .875rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}
.objective-icon {
  position: relative;
  display: inline-block;
  flex: none;
  width: 21px;
  height: 21px;
}
.objective-icon .expression { animation: none; }
.score-total { font-variant-numeric: tabular-nums; }
.score-total strong { display: inline-block; }
.stat { grid-area: moves; justify-content: flex-end; white-space: nowrap; }
.score-total strong, .stat strong {
  color: var(--ink);
  font: 800 1.25rem/1 var(--display);
  letter-spacing: -.025em;
  font-variant-numeric: tabular-nums;
}
.stat strong.low {
  padding: 2px 6px;
  border-radius: 7px;
  background: var(--ready-bg);
  color: var(--ready-text);
  animation: moves-pulse 1.3s ease-in-out infinite;
}
@keyframes moves-pulse {
  50% { transform: scale(1.07); }
}
progress {
  display: block;
  width: 100%;
  height: 5px;
  margin-top: 4px;
  border: 0;
  border-radius: 10px;
  overflow: hidden;
  appearance: none;
  background: color-mix(in srgb, var(--accent) 30%, var(--surface));
}
progress::-webkit-progress-bar { background: color-mix(in srgb, var(--accent) 30%, var(--surface)); }
progress::-webkit-progress-value { background: var(--accent); border-radius: 10px; transition: width 220ms ease; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 10px; }
.dialog .record { margin-top: 8px; }
.record strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.controls { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.turn-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-height: 44px;
  padding: 5px 10px 5px 12px;
  border: 1px solid var(--control-edge);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font-size: .875rem;
  font-weight: 800;
  transition: color 140ms, background-color 140ms, border-color 140ms, transform 120ms;
}
.turn-button:hover { background: var(--hover); }
.turn-button.ready { border-color: var(--ready-border); background: var(--ready-bg); color: var(--ready-text); }
.turn-button.ready:hover { background: var(--ready-bg-hover); }
.turn-button[aria-pressed="true"] { border-color: var(--turn-active-border); background: var(--turn-active-bg); color: white; }
.turn-button:disabled { opacity: .65; }
.turn-label { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.turn-icon { font-size: 1.2rem; line-height: 1; }
.energy {
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--tint);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.ready .energy { background: var(--ready-pill-bg); color: var(--ready-pill-text); }
.turn-button[aria-pressed="true"] .energy { background: rgb(255 255 255 / .22); color: white; }
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 49px;
  padding: 8px 18px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 800;
  font-size: .95rem;
  transition: background-color 140ms, transform 140ms;
}
.primary-button:hover { background: var(--accent-hover); }
.primary-button:disabled { opacity: .63; }
.primary-button > span { font-size: 1.2rem; line-height: 1; color: var(--on-accent); }
.restart-button { padding-inline: 8px; font-size: 1.6rem; line-height: 1; }

.playfield { display: grid; gap: 10px; min-width: 0; }
.view-switch {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--edge);
  border-radius: 12px;
  background: var(--tint);
}
.view-switch button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  min-width: 44px;
  padding: 4px 12px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: .875rem;
  font-weight: 750;
  transition: background-color 140ms, color 140ms, transform 120ms;
}
.view-switch button:hover { background: var(--hover); }
.view-switch button[aria-pressed="true"] {
  background: var(--accent);
  color: var(--on-accent);
}
.view-switch button:focus-visible { outline-offset: 1px; }
.view-icon {
  width: 13px;
  height: 13px;
  flex: none;
  border: 1px solid currentColor;
  border-radius: 2px;
  background:
    linear-gradient(currentColor, currentColor) center / 1px 100% no-repeat,
    linear-gradient(currentColor, currentColor) center / 100% 1px no-repeat;
}
.view-icon-iso { transform: rotateX(42deg) rotateZ(45deg); }
.view-short { display: none; }
.level-title { display: flex; align-items: center; gap: 8px; }
#level-number {
  display: grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 28px;
  color: var(--on-accent);
  background: var(--accent);
  border-radius: 7px;
  font: 800 .9rem/1 var(--display);
  font-variant-numeric: tabular-nums;
}
#level-number.wide { width: auto; min-width: 32px; padding-inline: 6px; }
.level-title h2 { font: 800 clamp(.875rem, 2.25vw, 1.3rem)/1.15 var(--display); letter-spacing: -.025em; }
.mode-caption { margin-bottom: 2px; color: var(--muted); font-size: .72rem; font-weight: 750; line-height: 1.25; }
.board-well {
  isolation: isolate;
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  padding: clamp(8px, 1.3vw, 14px);
  border: 1px solid var(--stage-edge);
  border-radius: 18px;
  background: var(--stage);
}
.board-well[data-view="flat"] {
  width: min(100%, clamp(360px, calc(100svh - 260px), 650px));
  margin-inline: auto;
}
.board {
  position: relative;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: clamp(4px, .7vw, 8px);
  overflow: clip;
  overflow-clip-margin: 5px;
  user-select: none;
  -webkit-user-select: none;
}
.board-well[data-view="iso"] {
  --iso-default: 54;
  --iso-tilt: 54deg;
  --iso-yaw: 45deg;
  --iso-scale: .9;
  --iso-offset: 0px;
  --emoji-stretch: 1.56;
  --cube-depth: 36px;
  --tray-depth: 26px;
  --pedestal-depth: 7px;
  --explode-gap: 0px;
  aspect-ratio: 1.72;
  overflow: clip;
  background:
    radial-gradient(color-mix(in srgb, var(--accent) 16%, transparent) 1px, transparent 1.5px) 0 0 / 20px 20px,
    radial-gradient(ellipse at 49% 31%, var(--stage-light), var(--stage-alt) 95%);
}
.board-well[data-view="iso"].camera-smooth .board,
.board-well[data-view="iso"].camera-smooth .board-deck {
  transition: transform 240ms cubic-bezier(.22, .8, .36, 1);
}
.board-well[data-view="iso"].camera-smooth .tile {
  transition: translate 240ms cubic-bezier(.22, .8, .36, 1);
}
.board-well[data-view="iso"].camera-smooth .tile .face {
  transition: transform 240ms cubic-bezier(.22, .8, .36, 1);
}
.board-well[data-view="iso"].camera-smooth .ambient-prop {
  transition: translate 240ms cubic-bezier(.22, .8, .36, 1);
}
.board-well[data-view="iso"] .board {
  gap: clamp(5px, 1vw, 13px);
  position: absolute;
  inset-inline: 0;
  top: 50%;
  width: calc(68% - 17px);
  margin-inline: auto;
  overflow: visible;
  transform-style: preserve-3d;
  transform: translateY(calc(-50% + var(--iso-offset))) scale(var(--iso-scale)) rotateX(var(--iso-tilt)) rotateZ(var(--iso-yaw));
}
.board-deck, .prism-wall { display: none; }
.board-well[data-view="iso"] .board-deck {
  --prism-depth: var(--tray-depth);
  --side: var(--deck-depth);
  --edge: var(--deck-edge);
  display: block;
  position: absolute;
  inset: -3.2%;
  pointer-events: none;
  transform-style: preserve-3d;
  transform: translateZ(calc(-1 * var(--tray-depth) - var(--explode-gap)));
}
.board-deck::before, .board-deck::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 14px;
  border: 1.5px solid var(--deck-edge);
  background: linear-gradient(145deg, var(--deck-rim), var(--deck));
}
.board-deck::before {
  transform: translateZ(var(--tray-depth));
  box-shadow:
    inset 0 0 0 3px color-mix(in srgb, var(--surface) 40%, transparent),
    inset 0 0 0 5px color-mix(in srgb, var(--deck-edge) 42%, transparent);
}
.board-deck::after {
  background: var(--deck-depth);
  box-shadow: var(--deck-shadow);
}
.board-well[data-view="iso"] .prism-wall {
  display: block;
  position: absolute;
  background: var(--side);
  backface-visibility: hidden;
}
.prism-wall.wall-north, .prism-wall.wall-south {
  inset-inline: 0;
  height: var(--prism-depth);
}
.board-well[data-view="iso"] .prism-wall.wall-east,
.board-well[data-view="iso"] .prism-wall.wall-west {
  inset-block: 0;
  width: var(--prism-depth);
}
.board-well[data-view="iso"] .prism-wall.wall-south {
  background: linear-gradient(180deg, color-mix(in srgb, var(--top, var(--deck-rim)) 42%, var(--side)) 0%, var(--side) 58%, color-mix(in srgb, var(--side) 84%, var(--edge)) 100%);
}
.board-well[data-view="iso"] .prism-wall.wall-east {
  background: linear-gradient(90deg, color-mix(in srgb, var(--side) 78%, var(--edge)) 0%, color-mix(in srgb, var(--side) 62%, var(--edge)) 100%);
}
.board-well[data-view="iso"] .prism-wall.wall-west {
  background: linear-gradient(270deg, color-mix(in srgb, var(--side) 70%, var(--edge)) 0%, color-mix(in srgb, var(--side) 52%, var(--edge)) 100%);
}
.board-well[data-view="iso"] .prism-wall.wall-north {
  background: linear-gradient(0deg, color-mix(in srgb, var(--side) 80%, var(--light, var(--deck-rim))) 0%, color-mix(in srgb, var(--side) 60%, var(--edge)) 100%);
}
.board-well[data-view="iso"] .tile .prism-wall {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--edge) 42%, transparent);
}
.wall-north { top: 0; transform-origin: center top; transform: rotateX(90deg); }
.wall-south { bottom: 0; transform-origin: center bottom; transform: rotateX(-90deg); }
.wall-west { left: 0; transform-origin: left center; transform: rotateY(-90deg); }
.wall-east { right: 0; transform-origin: right center; transform: rotateY(90deg); }
.board-well[data-view="iso"] :is(.cell, .tile) { transform-style: preserve-3d; }
.board-well[data-view="iso"] .cell::before {
  inset: -2%;
  border-radius: 14%;
  border: 1px solid var(--pedestal-edge);
  transform: translateZ(var(--pedestal-depth));
}
.board-well[data-view="iso"] .cell:not([data-jelly])::before {
  background: linear-gradient(145deg, var(--pedestal-top), color-mix(in srgb, var(--pedestal-top) 74%, var(--pedestal-edge)));
  box-shadow:
    2px 2px 0 var(--pedestal-side),
    4px 4px 0 color-mix(in srgb, var(--pedestal-side) 78%, var(--deck-depth)),
    inset 0 1px 0 rgb(255 255 255 / .62);
}
.board-well[data-view="iso"] .cell:not([data-jelly])::after {
  content: "";
  position: absolute;
  inset: 7%;
  border-radius: 14%;
  background: rgb(26 14 48 / .24);
  filter: blur(2.5px);
  pointer-events: none;
  transform: translateZ(calc(var(--pedestal-depth) + .5px)) translate(2px, 2px);
  transition: transform 150ms ease-out, opacity 150ms ease-out, filter 150ms ease-out;
}
.board-well[data-view="iso"] .cell:not([data-jelly]):has(.tile:is(.group, .hinted, .swap-origin, .swap-hover, .booster-origin, .turn-preview))::after,
.board-well[data-view="iso"][data-exploded="true"] .cell:not([data-jelly])::after {
  opacity: .42;
  filter: blur(5px);
  transform: translateZ(calc(var(--pedestal-depth) + .5px)) translate(5px, 5px) scale(1.08);
}
.board-well[data-view="iso"] .tile {
  --prism-depth: var(--cube-depth);
  appearance: none;
  overflow: visible;
  border-radius: 9%;
  translate: 0 0 calc(var(--pedestal-depth) + var(--explode-gap));
  transition: translate 140ms cubic-bezier(.22, .8, .36, 1);
}
.board-well[data-view="iso"] .tile::before { content: none; }
.board-well[data-view="iso"] .tile::after {
  bottom: 0;
  pointer-events: auto;
  transform: translateZ(var(--cube-depth));
}
.menu-tile .tile::before { inset: 0; transform: translate(11%, 11%); }
.menu-tile .tile::after, .menu-tile .face { bottom: 0; }
.menu-tile .face { transform: rotate(-45deg) scale(1.03, var(--emoji-stretch)); }
.board-well[data-view="iso"] .tile .face {
  bottom: 0;
  transform: translateZ(calc(var(--cube-depth) + 1px)) rotateZ(calc(-1 * var(--iso-yaw))) scale(1.03, var(--emoji-stretch));
}
.board-well[data-view="iso"] .tile:is(.group, .hinted, .swap-origin, .swap-hover, .booster-origin) {
  translate: 0 0 calc(var(--pedestal-depth) + var(--explode-gap) + 12px);
}
.board-well[data-view="iso"] .tile:is(.booster-ready, .turn-preview) {
  translate: 0 0 calc(var(--pedestal-depth) + var(--explode-gap) + 7px);
}
.board-well[data-view="iso"] button.tile:not(.frozen):not([data-blocker]):active {
  translate: 0 0 calc(var(--pedestal-depth) + var(--explode-gap) - 2px);
}
.board-well[data-view="iso"] button.tile:not(.frozen):not([data-blocker]):active::after {
  transform: translateZ(var(--cube-depth));
}
.board-well[data-view="iso"] .tile.frozen { --side: #7db2d0; --edge: #4f8baa; }

/* Ambient floating 3D voxel props, voxel burst canvas, and floating callout banner */
.ambient-props { display: none; }
.board-well[data-view="iso"] .ambient-props {
  display: block;
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
}
.ambient-prop {
  position: absolute;
  display: grid;
  justify-items: center;
  gap: 8px;
  translate: 0 calc(-0.5 * var(--explode-gap, 0px));
}
.ambient-prop .prop-body {
  display: block;
  filter: drop-shadow(0 6px 10px rgb(28 14 54 / .2));
  animation: prop-float var(--prop-dur, 4.4s) ease-in-out var(--prop-delay, 0s) infinite;
}
.ambient-prop .prop-shadow {
  display: block;
  width: 24px;
  height: 8px;
  border-radius: 50%;
  background: rgb(28 14 54 / .18);
  filter: blur(2.5px);
  animation: prop-shadow var(--prop-dur, 4.4s) ease-in-out var(--prop-delay, 0s) infinite;
}
:root[data-theme="night"] .ambient-prop .prop-shadow {
  background: rgb(4 1 12 / .48);
}
.ambient-prop-heart { left: 4.5%; bottom: 10%; --prop-dur: 4.6s; --prop-delay: -.4s; }
.ambient-prop-plus { right: 5%; top: 17%; --prop-dur: 4.1s; --prop-delay: -1.4s; }
.ambient-prop-sparkle { left: 5%; top: 24%; --prop-dur: 5s; --prop-delay: -2.2s; }
.ambient-prop-voxel { right: 5.5%; bottom: 11%; --prop-dur: 4.4s; --prop-delay: -.9s; }
@keyframes prop-float {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50% { transform: translateY(-9px) rotate(3deg); }
}
@keyframes prop-shadow {
  0%, 100% { transform: scale(1); opacity: .85; }
  50% { transform: scale(.74); opacity: .45; }
}

.voxel-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 6;
}

.burst-banner {
  position: absolute;
  top: 12px;
  left: 50%;
  z-index: 7;
  transform: translateX(-50%);
  padding: 7px 16px;
  border: 1.5px solid color-mix(in srgb, var(--banner-accent) 60%, transparent);
  border-radius: 999px;
  background: var(--banner-bg);
  color: var(--banner-ink);
  box-shadow: 0 10px 26px rgb(18 8 42 / .28), inset 0 1px 0 rgb(255 255 255 / .18);
  font: 800 .88rem/1.15 var(--display);
  letter-spacing: .04em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.burst-banner[data-tone="combo"] {
  border-color: var(--banner-accent);
  box-shadow: 0 10px 28px rgb(18 8 42 / .34), 0 0 0 2px color-mix(in srgb, var(--banner-accent) 28%, transparent);
}
.burst-banner[data-tone="power"] {
  border-color: color-mix(in srgb, var(--accent) 70%, white);
}
.burst-banner.is-popping {
  animation: burst-banner-pop 1150ms cubic-bezier(.16, 1.28, .3, 1) forwards;
}
@keyframes burst-banner-pop {
  0% { opacity: 0; transform: translate(-50%, -8px) scale(.76); }
  16% { opacity: 1; transform: translate(-50%, 0) scale(1.05); }
  26% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  80% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -6px) scale(.94); }
}

.arena-container { position: relative; min-width: 0; }
.camera-tools { position: absolute; z-index: 5; top: 9px; left: 9px; }
.camera-panel {
  display: grid;
  gap: 9px;
  width: min(232px, calc(100vw - 48px));
  margin-top: 6px;
  padding: 11px;
  border: 1px solid var(--control-edge);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--elev);
  color: var(--ink);
  font-size: .875rem;
}
.camera-panel p { color: var(--muted); font-size: .82rem; }
.camera-presets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
.camera-preset { min-width: 0; min-height: 36px; padding: 0 6px; font-size: .78rem; border-radius: 8px; }
.camera-preset[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.camera-label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-variant-numeric: tabular-nums;
}
.camera-label-row output { color: var(--accent); font-size: .8rem; font-weight: 800; }
.camera-panel label { display: grid; gap: 3px; font-weight: 700; }
.camera-panel input { width: 100%; min-height: 27px; margin: 0; accent-color: var(--accent); }
.camera-panel input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.camera-explode-group {
  display: grid;
  gap: 7px;
  padding-top: 8px;
  border-top: 1px solid var(--edge);
}
.camera-explode-btn {
  min-height: 38px;
  padding: 0 10px;
  font-size: .82rem;
  border-radius: 9px;
}
.camera-explode-btn[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.group-preview-badge {
  position: absolute;
  z-index: 5;
  top: 9px;
  right: 9px;
  padding: 6px 12px;
  border: 1px solid var(--control-edge);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--elev);
  color: var(--ink);
  font-size: .82rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.group-preview-badge[data-combo="true"] {
  border-color: var(--ready-border);
  background: var(--ready-bg);
  color: var(--ready-text);
}
.board-well[data-adjusting="true"] { touch-action: none; cursor: grab; }
.board-well[data-adjusting="true"] .tile { cursor: grab; }
.board-well[data-adjusting="true"]:active { cursor: grabbing; }
.cell { position: relative; aspect-ratio: 1; min-width: 0; }
.cell::before {
  position: absolute;
  inset: 0 0 1%;
  border-radius: 19%;
  background: var(--deck);
  content: "";
}
.tile {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 19%;
  background: transparent;
}
.tile::before, .tile::after {
  position: absolute;
  content: "";
  pointer-events: none;
  border-radius: inherit;
  inset: 0;
}
.tile::before {
  border: 1px solid var(--edge);
  inset: 2% 0 0;
  background: var(--side);
  box-shadow: 0 2px 2px #45217238;
}
.tile::after {
  bottom: 12%;
  border: 1px solid var(--edge);
  background: linear-gradient(145deg, var(--light), var(--top));
  box-shadow: inset 0 2px 0 #ffffff79, inset 0 -2px 0 #ffffff35;
  transition: transform 140ms, filter 140ms;
}
:where(.board-well[data-view="iso"]) .tile::after {
  box-shadow:
    inset 0 2px 0 rgb(255 255 255 / .76),
    inset 2px 0 0 rgb(255 255 255 / .36),
    inset 0 -2px 0 rgb(0 0 0 / .14);
}
.tile.group::after { filter: brightness(1.13); }
button.tile:not(.frozen):not([data-blocker]):active::after { transform: translateY(4%) scale(.96); }
.tile.group::after, .tile.group .face { transform: translateY(-4%); }
.tile.hinted { outline: 2px dashed #35245c; outline-offset: -3px; z-index: 2; }
.tile.hinted .face { transform: translateY(-4%) scale(1.09); }
.tile.turned::after { box-shadow: inset 0 0 0 2px #663651; border-style: dashed; }
.tile.turn-preview::after {
  border: 2px solid #602845;
  box-shadow: inset 0 0 0 2px #fff1f8;
  filter: brightness(1.13);
}
.tile.turn-preview { z-index: 2; }
.tile.turn-anchor::after { border-style: dashed; }
.tile.guide-anchor::after, .tile.guide-combo::after {
  border: 2px solid #3f246d;
  box-shadow: inset 0 0 0 2px white;
}
.tile.guide-anchor::after { border-style: dashed; }
.tile.guide-anchor, .tile.guide-combo { z-index: 2; }
.tile.frozen { cursor: help; }
.tile.frozen::after {
  border: 2px solid #347696;
  background: linear-gradient(137deg, #f1fcff 4%, #a6d9ee 30%, #def4fc 42%, #81bddc 100%);
  box-shadow: inset 0 0 0 2px #e6f9ff;
}
.tile.frozen .expression { opacity: .43; animation: none; }
.tile.frozen .face::after {
  content: "❄";
  content: "❄" / "";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #165775;
  text-shadow: 0 1px #fff;
  font: 800 max(1.15rem, 38cqw)/1 var(--body);
}
.tile.swap-ready::after { border: 2px dashed #302061; }
.tile.swap-origin::after {
  border: 2px solid #302061;
  box-shadow: inset 0 0 0 2px white;
}
.tile.swap-dragging {
  z-index: 4;
  transform: translate(var(--drag-x, 0px), var(--drag-y, 0px)) scale(1.05);
}
.tile.swap-hover { z-index: 3; }
.tile.swap-hover::after {
  border: 2px solid var(--accent);
  box-shadow: inset 0 0 0 2px #fff;
  filter: brightness(1.12);
}
.tile.swap-hint::after {
  border: 2px solid #38247a;
  box-shadow: inset 0 0 0 2px #e6d6ff;
}
.tile[data-power]::after {
  box-shadow: inset 0 0 0 2px rgb(255 255 255 / .75), inset 0 2px 0 #ffffff96;
}
.tile[data-power="bomb"]::after {
  box-shadow: inset 0 0 0 2px #ffe08a, inset 0 2px 0 #ffffff96;
}
.tile[data-power="prism"]::after {
  box-shadow: inset 0 0 0 2.5px #f0d7ff, 0 0 10px rgb(162 110 255 / .45);
}
.tile[data-power="seeker"]::after {
  box-shadow: inset 0 0 0 2.5px #89f5dc, 0 0 10px rgb(28 186 154 / .45);
}
.tile[data-power] .face::before {
  content: "↔";
  content: "↔" / "";
  position: absolute;
  z-index: 1;
  top: 7%;
  right: 13%;
  display: grid;
  place-items: center;
  min-width: 24%;
  aspect-ratio: 1;
  padding-inline: 2px;
  border: 1.5px solid #42255c;
  border-radius: 5px;
  background: #fff6fc;
  color: #42255c;
  box-shadow: 0 1px 3px rgb(43 20 73 / .22);
  font: 800 max(.65rem, 19cqw)/1 var(--body);
  animation: power-badge-pulse 1.8s ease-in-out infinite;
}
.tile[data-power="column"] .face::before { content: "↕"; content: "↕" / ""; }
.tile[data-power="bomb"] .face::before { content: "✹"; content: "✹" / ""; color: #812b13; background: #fff1cf; border-color: #9e471a; }
.tile[data-power="prism"] .face::before {
  content: "◆";
  content: "◆" / "";
  color: #46207d;
  background: linear-gradient(135deg, #ffe7f7, #e4f7ff, #fff5d1);
  border-color: #6b36b8;
}
.tile[data-power="seeker"] .face::before {
  content: "▸";
  content: "▸" / "";
  color: #0e594d;
  background: linear-gradient(135deg, #e0fff7, #a4f4e1);
  border-color: #167a68;
}
@keyframes power-badge-pulse {
  50% { transform: scale(1.08); }
}
body[data-mode="match"] .tile,
body[data-mode="special"] .tile { touch-action: none; }
.tile:focus-visible { z-index: 3; outline-offset: 2px; }
.tile.invalid { animation: nudge 230ms ease; }
.tile[data-type="0"] { --light: #ffda70; --top: #ffc64a; --side: #e6a328; --edge: #b8791b; --face: #5b3b21; }
.tile[data-type="1"] { --light: #a58afd; --top: #936ff4; --side: #7450cb; --edge: #6445a9; --face: #301c58; }
.tile[data-type="2"] { --light: #81e4c4; --top: #5bd8b0; --side: #32ab8b; --edge: #298570; --face: #204f47; }
.tile[data-type="3"] { --light: #ffa4cd; --top: #ff84b6; --side: #de5e99; --edge: #b54d7b; --face: #612849; }
.tile[data-type="4"] { --light: #87ceff; --top: #63b6ff; --side: #3e92dc; --edge: #336da7; --face: #203d70; }
.tile[data-type="5"] { --light: #ff9a93; --top: #f47776; --side: #c85159; --edge: #913a47; --face: #672a39; --reaction: face-wiggle; }
.tile[data-type="6"] { --light: #faf0e9; --top: #ded4eb; --side: #b8a8d0; --edge: #8675a1; --face: #514366; --reaction: face-drowse; }
.tile[data-type="7"] { --light: #dcf398; --top: #c4e76c; --side: #9cbd3d; --edge: #69892d; --face: #455813; --reaction: face-wiggle; }
.tile[data-type="8"] { --light: #ffc17a; --top: #ffa460; --side: #db7633; --edge: #a35025; --face: #633117; }
.tile[data-type="9"] { --light: #ffab88; --top: #f98768; --side: #d3624c; --edge: #a64838; --face: #613126; --reaction: face-laugh; }
.tile[data-type="10"] { --light: #87e6f4; --top: #49c9e0; --side: #279bb6; --edge: #2c7c94; --face: #18465e; --reaction: face-wiggle; }
.tile[data-type="11"] { --light: #d9a1f6; --top: #b678da; --side: #8c4bad; --edge: #753b8e; --face: #462152; }
.tile[data-type="12"] { --light: #ffe5ec; --top: #f8bfd1; --side: #ce8da7; --edge: #9c607d; --face: #66324d; --reaction: face-float; }
.tile[data-type="13"] { --light: #8899e8; --top: #6379cd; --side: #4c5ea7; --edge: #455284; --face: #232954; --reaction: face-wiggle; }
.tile[data-type="14"] { --light: #efc69a; --top: #dca77c; --side: #b47e59; --edge: #8d644d; --face: #52392e; }
.tile[data-type="15"] { --light: #d2dae6; --top: #a4b2c8; --side: #7889a4; --edge: #687b98; --face: #263a58; --reaction: face-wiggle; }
.tile[data-type="16"] { --light: #f0f4ff; --top: #cfd8fc; --side: #a7b3e5; --edge: #7784b9; --face: #34306a; --reaction: face-float; }
.tile[data-type="17"] { --light: #c5f692; --top: #97d968; --side: #6aaa48; --edge: #4a8438; --face: #224820; --reaction: face-float; }
.tile[data-type="1"] { --reaction: face-drowse; }
.tile[data-type="4"] { --reaction: face-wiggle; }

/* Multi-layer Candy-Crush blockers & jelly pedestals */
.tile[data-blocker="ice"][data-layers="2"]::after {
  border: 2.5px solid #1d5d7f;
  background:
    linear-gradient(125deg, transparent 42%, rgb(255 255 255 / .7) 48%, transparent 54%),
    linear-gradient(140deg, #effbff 2%, #7cc4e6 34%, #c9effc 52%, #509cc4 100%);
  box-shadow: inset 0 0 0 3px #dff7ff, inset 0 0 0 5px rgb(29 93 127 / .42);
}
.tile[data-blocker="ice"][data-layers="2"] .expression { opacity: .28; }
.tile[data-blocker="ice"][data-layers="2"] .face::before {
  content: "2";
  content: "2" / "";
  position: absolute;
  z-index: 2;
  bottom: 8%;
  right: 10%;
  display: grid;
  place-items: center;
  min-width: 24%;
  aspect-ratio: 1;
  border: 1.5px solid #174f6d;
  border-radius: 5px;
  background: #e9f9ff;
  color: #13445f;
  font: 800 max(.62rem, 18cqw)/1 var(--body);
  font-variant-numeric: tabular-nums;
}
.board-well[data-view="iso"] .tile[data-blocker="ice"][data-layers="2"] {
  --side: #5596bd;
  --edge: #286284;
}
:root[data-theme="night"] .tile[data-blocker="ice"][data-layers="2"]::after {
  border-color: #79d2fa;
  box-shadow: inset 0 0 0 3px #d9f6ff, inset 0 0 0 5px rgb(34 114 152 / .5);
}

.tile[data-blocker="lock"] { cursor: not-allowed; }
.tile[data-blocker="lock"] .expression { opacity: .76; animation: none; }
.tile[data-blocker="lock"]::after {
  border: 2px solid #593b87;
  box-shadow: inset 0 0 0 2px rgb(255 255 255 / .55), inset 0 -2px 0 rgb(44 24 72 / .28);
}
.tile[data-blocker="lock"] .face::after {
  content: "";
  position: absolute;
  inset: 5%;
  border-radius: 14%;
  background:
    linear-gradient(45deg, transparent 41%, #422a6b 42%, #d8c8f5 48%, #f8f2ff 50%, #422a6b 58%, transparent 59%),
    linear-gradient(-45deg, transparent 41%, #422a6b 42%, #d8c8f5 48%, #f8f2ff 50%, #422a6b 58%, transparent 59%);
  opacity: .92;
}
:root[data-theme="dusk"] .tile[data-blocker="lock"]::after { border-color: #7d3e31; }
:root[data-theme="dusk"] .tile[data-blocker="lock"] .face::after {
  background:
    linear-gradient(45deg, transparent 41%, #682f24 42%, #f4cbbd 48%, #fff6f1 50%, #682f24 58%, transparent 59%),
    linear-gradient(-45deg, transparent 41%, #682f24 42%, #f4cbbd 48%, #fff6f1 50%, #682f24 58%, transparent 59%);
}
:root[data-theme="night"] .tile[data-blocker="lock"]::after { border-color: #cab0ff; }
:root[data-theme="night"] .tile[data-blocker="lock"] .face::after {
  background:
    linear-gradient(45deg, transparent 41%, #2c1b4d 42%, #c9b2fa 48%, #f2eaff 50%, #2c1b4d 58%, transparent 59%),
    linear-gradient(-45deg, transparent 41%, #2c1b4d 42%, #c9b2fa 48%, #f2eaff 50%, #2c1b4d 58%, transparent 59%);
}

.tile[data-blocker="crate"],
.tile[data-blocker="spread"] { cursor: not-allowed; }
.tile[data-blocker="crate"] .expression,
.tile[data-blocker="spread"] .expression { display: none; }

.tile[data-blocker="crate"] {
  --light: #f4be72;
  --top: #d98e38;
  --side: #a6621f;
  --edge: #733f0f;
}
.tile[data-blocker="crate"]::after {
  border: 2px solid #754111;
  background:
    repeating-linear-gradient(90deg, transparent 0 22%, rgb(117 65 17 / .28) 22% 28%),
    repeating-linear-gradient(0deg, transparent 0 22%, rgb(117 65 17 / .28) 22% 28%),
    linear-gradient(145deg, #f7c77e, #d58831);
  box-shadow: inset 0 2px 0 rgb(255 246 218 / .65), inset 0 -3px 0 rgb(104 54 12 / .42);
}
.tile[data-blocker="crate"][data-layers="2"]::after {
  background:
    linear-gradient(132deg, transparent 45%, #5c2e09 47% 51%, #ffe3b0 52% 54%, transparent 55%),
    repeating-linear-gradient(90deg, transparent 0 26%, rgb(117 65 17 / .22) 26% 31%),
    linear-gradient(145deg, #f3c47f, #ca7f2e);
}
.tile[data-blocker="crate"][data-layers="1"]::after {
  border-style: dashed;
  background:
    linear-gradient(132deg, transparent 44%, #5c2e09 46% 51%, transparent 52%),
    linear-gradient(48deg, transparent 44%, #5c2e09 46% 51%, transparent 52%),
    linear-gradient(145deg, #f0c98e, #be7a32);
}
.tile[data-blocker="crate"] .face::before {
  content: "";
  position: absolute;
  z-index: 2;
  bottom: 8%;
  right: 10%;
  display: grid;
  place-items: center;
  min-width: 24%;
  aspect-ratio: 1;
  border: 1.5px solid #5c2e09;
  border-radius: 5px;
  background: #fff2d6;
  color: #5c2e09;
  font: 800 max(.62rem, 18cqw)/1 var(--body);
  font-variant-numeric: tabular-nums;
}
.tile[data-blocker="crate"][data-layers="3"] .face::before { content: "3"; content: "3" / ""; }
.tile[data-blocker="crate"][data-layers="2"] .face::before { content: "2"; content: "2" / ""; }
.tile[data-blocker="crate"][data-layers="1"] .face::before { content: "1"; content: "1" / ""; }
:root[data-theme="night"] .tile[data-blocker="crate"]::after {
  border-color: #f0b35c;
  box-shadow: inset 0 2px 0 rgb(255 240 205 / .55), inset 0 -3px 0 rgb(62 28 4 / .55);
}

.tile[data-blocker="spread"] {
  --light: #764836;
  --top: #4b271c;
  --side: #331810;
  --edge: #210e08;
}
.tile[data-blocker="spread"]::after {
  border: 2px solid #2b130c;
  background:
    radial-gradient(ellipse at 28% 24%, rgb(255 224 202 / .36), transparent 46%),
    linear-gradient(145deg, #6e4130 0%, #4a251a 52%, #31160f 100%);
  box-shadow: inset 0 2px 0 rgb(255 215 186 / .32), inset 0 -3px 0 rgb(20 8 5 / .55);
}
.tile[data-blocker="spread"] .face::after {
  content: "";
  position: absolute;
  inset: 18%;
  border-radius: 30% 42% 36% 48%;
  border: 2px solid rgb(255 210 182 / .28);
  background: linear-gradient(140deg, rgb(255 222 198 / .2), transparent 65%);
}
:root[data-theme="night"] .tile[data-blocker="spread"]::after {
  border-color: #a66f56;
  box-shadow: inset 0 2px 0 rgb(255 215 186 / .38), 0 0 0 1px rgb(166 111 86 / .35);
}

.cell[data-jelly="1"]::before {
  background: linear-gradient(145deg, #ffd1e6, #f48bb8);
  box-shadow: inset 0 0 0 2px rgb(255 255 255 / .65), 0 0 8px rgb(235 88 152 / .35);
}
.cell[data-jelly="2"]::before {
  background: linear-gradient(145deg, #ff99c8, #d94689);
  box-shadow: inset 0 0 0 2.5px #ffe5f2, 0 0 12px rgb(217 70 137 / .5);
}
.cell[data-jelly]::after {
  content: "";
  position: absolute;
  inset: -2px;
  z-index: 2;
  border-radius: 21%;
  pointer-events: none;
}
.cell[data-jelly="1"]::after {
  border: 2.5px solid #e64d91;
  box-shadow: inset 0 0 0 2px rgb(255 218 236 / .72);
}
.cell[data-jelly="2"]::after {
  border: 3px solid #b81d66;
  box-shadow: inset 0 0 0 3px rgb(255 170 210 / .85), 0 0 10px rgb(217 44 124 / .42);
}
.board-well[data-view="iso"] .cell[data-jelly]::after {
  inset: -1px;
  border-radius: 14%;
  transform: translateZ(calc(var(--pedestal-depth) + 1px));
}
:root[data-theme="dusk"] .cell[data-jelly="1"]::after { border-color: #d95236; }
:root[data-theme="dusk"] .cell[data-jelly="2"]::after { border-color: #a82818; }
:root[data-theme="night"] .cell[data-jelly="1"]::after { border-color: #ff7ab8; }
:root[data-theme="night"] .cell[data-jelly="2"]::after {
  border-color: #ff4f9e;
  box-shadow: inset 0 0 0 3px rgb(255 182 218 / .75), 0 0 12px rgb(255 79 158 / .52);
}
.face { container-type: inline-size; position: absolute; inset: 0 0 12%; z-index: 1; color: var(--face); pointer-events: none; transition: transform 140ms; }
.expression {
  position: absolute;
  inset: 0;
  animation: var(--reaction, face-hop) 560ms var(--react-delay) both;
}
.tile:is(.group, .hinted, .turn-preview) .expression { animation: face-react 270ms ease-out both; }
@keyframes face-hop { 35% { transform: translateY(-7%) scale(1.06, .97); } 64% { transform: translateY(2%) scale(.98, 1.03); } }
@keyframes face-drowse { 44% { transform: translateY(5%) scaleY(.87); } }
@keyframes face-wiggle { 26% { transform: rotate(-7deg); } 60% { transform: rotate(6deg); } }
@keyframes face-laugh { 22%, 63% { transform: translateY(-5%) scale(1.06, .98); } 43%, 85% { transform: translateY(2%) scale(.98, 1.06); } }
@keyframes face-float { 42% { transform: translateY(-9%) rotate(4deg); } 72% { transform: translateY(1%) rotate(-2deg); } }
@keyframes face-react { 51% { transform: translateY(-5%) scale(1.07); } }
.eye, .mouth, .cheek, .detail { position: absolute; }
.eye {
  top: 35%;
  width: 11%;
  height: 18%;
  border-radius: 50%;
  background: currentColor;
}
.eye-left { left: 30%; }
.eye-right { right: 30%; }
.eye::after { content: ""; position: absolute; left: 21%; top: 15%; width: 36%; aspect-ratio: 1; border-radius: 50%; background: white; }
.mouth {
  left: 39%; top: 54%;
  width: 22%; height: 20%;
  border-radius: 20% 20% 48% 48%;
  background: currentColor;
  overflow: hidden;
}
.mouth::after { content: ""; position: absolute; inset: 59% 19% -19%; border-radius: 50%; background: #ff9dac; }
.cheek { top: 55%; width: 11%; height: 8%; background: #ed638b; opacity: .56; border-radius: 50%; }
.cheek-left { left: 17%; }
.cheek-right { right: 17%; }
.tile[data-type="1"] .eye { width: 17%; height: 13%; background: transparent; border-top: max(2px, 3.5cqw) solid currentColor; }
.tile[data-type="1"] .eye-left { left: 25%; }
.tile[data-type="1"] .eye-right { right: 25%; transform: rotate(-13deg); }
.tile[data-type="1"] .eye::after, .tile[data-type="1"] .mouth::after { display: none; }
.tile[data-type="1"] .mouth { left: 44%; width: 12%; height: 15%; border-radius: 50%; }
.tile[data-type="2"] .eye { width: 24%; height: 18%; border-radius: 18% 18% 46% 46%; }
.tile[data-type="2"] .eye-left { left: 22%; }
.tile[data-type="2"] .eye-right { right: 22%; }
.tile[data-type="2"] .eye::after { top: 11%; width: 38%; height: 30%; border-radius: 0; background: #abeedb; transform: rotate(-35deg); }
.tile[data-type="2"] .mouth { width: 19%; height: 13%; left: 40%; top: 60%; }
.tile[data-type="2"] .mouth::after { display: none; }
.tile[data-type="3"] .eye {
  top: 34%; width: 17%; height: 18%; border-radius: 0;
  clip-path: polygon(50% 100%, 4% 54%, 0 26%, 16% 6%, 36% 6%, 50% 24%, 65% 6%, 85% 6%, 100% 26%, 96% 54%);
}
.tile[data-type="3"] .eye-left { left: 26%; }
.tile[data-type="3"] .eye-right { right: 26%; }
.tile[data-type="3"] .mouth { width: 28%; left: 36%; }
.tile[data-type="4"] .eye { height: 21%; width: 13%; }
.tile[data-type="4"] .mouth { left: 42%; top: 58%; width: 16%; height: 15%; border-radius: 50%; }
.tile[data-type="4"] .cheek { background: #8d78e8; }
.tile[data-type="5"] .eye { top: 37%; width: 16%; height: 13%; border-radius: 15% 15% 50% 50%; }
.tile[data-type="5"] .eye-left { left: 28%; transform: rotate(26deg); }
.tile[data-type="5"] .eye-right { right: 28%; transform: rotate(-26deg); }
.tile[data-type="5"] .mouth { border-radius: 60% 60% 15% 15%; height: 12%; top: 60%; }
.tile[data-type="5"] :is(.eye, .mouth)::after { display: none; }
.tile[data-type="6"] .eye { top: 41%; width: 17%; height: 11%; background: transparent; border-bottom: max(1.5px, 3.4cqw) solid currentColor; }
.tile[data-type="6"] .eye-left { left: 25%; }
.tile[data-type="6"] .eye-right { right: 25%; }
.tile[data-type="6"] .mouth { left: 46%; top: 58%; width: 9%; height: 11%; border-radius: 50%; }
.tile[data-type="6"] :is(.eye, .mouth)::after { display: none; }
.tile[data-type="7"] .eye { width: 16%; height: 17%; background: linear-gradient(45deg, transparent 42%, currentColor 42% 58%, transparent 58%), linear-gradient(-45deg, transparent 42%, currentColor 42% 58%, transparent 58%); }
.tile[data-type="7"] .eye-left { left: 27%; }
.tile[data-type="7"] .eye-right { right: 27%; }
.tile[data-type="7"] .eye::after { display: none; }
.tile[data-type="7"] .mouth { width: 15%; left: 43%; top: 57%; transform: rotate(-11deg); }
.tile[data-type="8"] .eye { width: 16%; height: 17%; border-radius: 0; clip-path: polygon(50% 0, 69% 29%, 100% 50%, 69% 70%, 50% 100%, 30% 70%, 0 50%, 30% 29%); }
.tile[data-type="8"] .eye-left { left: 26%; }
.tile[data-type="8"] .eye-right { right: 26%; }
.tile[data-type="8"] .eye::after { display: none; }
.tile[data-type="8"] .mouth { left: 33%; width: 34%; top: 56%; }
.tile[data-type="8"] .mouth::after { inset: 0 12% 67%; border-radius: 0 0 24% 24%; background: #fff4e4; }

.tile[data-type="9"] .eye { top: 34%; width: 19%; height: 14%; background: transparent; border-top: max(2px, 4cqw) solid currentColor; }
.tile[data-type="9"] .eye-left { left: 24%; }
.tile[data-type="9"] .eye-right { right: 24%; }
.tile[data-type="9"] .eye::after { display: none; }
.tile[data-type="9"] .mouth { left: 31%; top: 49%; width: 38%; height: 27%; }
.tile[data-type="9"] .mouth::after { inset: 0 11% 67%; border-radius: 0 0 20% 20%; background: #fff4df; }

.tile[data-type="10"] .eye { top: 33%; height: 18%; }
.tile[data-type="10"] .mouth {
  top: 59%;
  height: 12%;
  background: transparent;
  border-top: max(2px, 4cqw) solid currentColor;
  border-radius: 50%;
}
.tile[data-type="10"] .mouth::after { display: none; }
.tile[data-type="10"] .cheek { top: 51%; width: 9%; height: 25%; background: #efffff; opacity: 1; border-radius: 35% 35% 65% 65%; }
.tile[data-type="10"] .cheek-left { left: 30%; }
.tile[data-type="10"] .cheek-right { right: 30%; }

.tile[data-type="11"] .eye-left { top: 42%; width: 16%; height: 5%; border-radius: 8px; transform: rotate(-10deg); }
.tile[data-type="11"] .eye-left::after { display: none; }
.tile[data-type="11"] .mouth { left: 39%; top: 56%; width: 25%; height: 17%; transform: rotate(-7deg); overflow: visible; }
.tile[data-type="11"] .mouth::after { inset: 40% 12% -30% 38%; border-radius: 20% 20% 50% 50%; background: #ff8fa8; }

.tile[data-type="12"] .eye { top: 33%; width: 17%; height: 20%; background: #fff5f8; }
.tile[data-type="12"] .eye-left { left: 27%; }
.tile[data-type="12"] .eye-right { right: 27%; }
.tile[data-type="12"] .eye::after { inset: 18% 13% auto auto; width: 48%; background: currentColor; }
.tile[data-type="12"] .mouth { left: 42%; top: 64%; width: 16%; height: 4%; border-radius: 8px; }
.tile[data-type="12"] .mouth::after { display: none; }

.tile[data-type="13"] .eye { top: 29%; width: 19%; height: 26%; background: #f4f6ff; }
.tile[data-type="13"] .eye-left { left: 25%; }
.tile[data-type="13"] .eye-right { right: 25%; }
.tile[data-type="13"] .eye::after { inset: 50% 24% auto auto; width: 41%; background: currentColor; }
.tile[data-type="13"] .mouth { left: 39%; top: 61%; width: 22%; height: 13%; }
.tile[data-type="13"] .mouth::after { inset: 12% 16% 50%; border-radius: 2px; background: #f3efff; }
.tile[data-type="13"] .cheek { display: none; }

.tile[data-type="14"] .detail { inset: 0; }
.tile[data-type="14"] .detail::before,
.tile[data-type="14"] .detail::after {
  content: "";
  position: absolute;
  top: 18%;
  width: 19%;
  height: 19%;
  background: #8a5747;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}
.tile[data-type="14"] .detail::before { left: 20%; transform: rotate(-23deg); }
.tile[data-type="14"] .detail::after { right: 20%; transform: rotate(23deg); }
.tile[data-type="14"] .eye { top: 41%; }
.tile[data-type="14"] .mouth { left: 44%; top: 59%; width: 12%; height: 10%; border-radius: 40% 40% 60% 60%; }
.tile[data-type="14"] .mouth::after { display: none; }
.tile[data-type="14"] .cheek { top: 59%; width: 13%; height: 4%; background: currentColor; box-shadow: 0 4cqw currentColor; }

.tile[data-type="15"] .eye { top: 37%; width: 21%; height: 18%; border-radius: 15%; }
.tile[data-type="15"] .eye-left { left: 24%; }
.tile[data-type="15"] .eye-right { right: 24%; }
.tile[data-type="15"] .eye::after { inset: 37% 20%; width: 60%; aspect-ratio: auto; border-radius: 2px; background: #91f9ef; }
.tile[data-type="15"] .mouth { left: 34%; top: 63%; width: 32%; height: 10%; border-radius: 3px; }
.tile[data-type="15"] .mouth::after {
  inset: 19% auto 19% 18%;
  width: 9%;
  border-radius: 0;
  background: #d0e4f0;
  box-shadow: 7cqw 0 #d0e4f0, 14cqw 0 #d0e4f0;
}
.tile[data-type="15"] .cheek { display: none; }
.tile[data-type="15"] .detail { left: 45%; top: 19%; width: 10%; aspect-ratio: 1; border: 1px solid currentColor; border-radius: 50%; background: #91f9ef; }

.tile[data-type="16"] .eye { top: 30%; width: 15%; height: 24%; }
.tile[data-type="16"] .eye-left { left: 27%; }
.tile[data-type="16"] .eye-right { right: 27%; }
.tile[data-type="16"] .mouth { top: 57%; left: 43%; width: 14%; height: 22%; border-radius: 50%; }
.tile[data-type="16"] .mouth::after { display: none; }
.tile[data-type="16"] .cheek { top: 58%; background: #9d8df5; }

.tile[data-type="17"] .eye { top: 34%; width: 24%; height: 20%; border-radius: 12% 70% 12% 70%; }
.tile[data-type="17"] .eye-left { left: 23%; }
.tile[data-type="17"] .eye-right { right: 23%; transform: scaleX(-1); }
.tile[data-type="17"] .eye::after { left: 35%; top: 26%; }
.tile[data-type="17"] .mouth { left: 42%; top: 62%; width: 16%; height: 9%; }
.tile[data-type="17"] .mouth::after, .tile[data-type="17"] .cheek { display: none; }
.tile[data-type="17"] .detail { left: 47%; top: 22%; width: 7%; aspect-ratio: 1; border-radius: 50%; background: #548e39; }

.effects { position: absolute; inset: 0; pointer-events: none; z-index: 4; overflow: hidden; }
.spark, .points, .ice-shard, .power-beam, .power-wave, .prism-pulse, .confetti { position: absolute; }
.spark { width: 7px; height: 7px; background: var(--pop-color); border-radius: 2px; animation: sparkle 450ms ease-out forwards; }
.ice-shard {
  width: 9px;
  height: 9px;
  background: linear-gradient(135deg, #ffffff, #88d8f7);
  border: 1px solid #398fb8;
  border-radius: 2px;
  transform: translate(-50%, -50%) rotate(45deg);
  animation: ice-burst 460ms cubic-bezier(.16, 1, .3, 1) forwards;
}
.power-beam {
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, #fff7d6 18%, #ffffff 50%, #c8b6ff 82%, transparent);
  box-shadow: 0 0 18px rgb(164 128 255 / .7);
  animation: beam-flash 360ms ease-out forwards;
}
.power-beam-row {
  width: 100%;
  height: var(--beam-size, 22px);
  transform: translateY(-50%);
}
.power-beam-column {
  height: 100%;
  width: var(--beam-size, 22px);
  background: linear-gradient(180deg, transparent, #fff7d6 18%, #ffffff 50%, #c8b6ff 82%, transparent);
  transform: translateX(-50%);
}
.power-wave {
  width: var(--wave-size, 150px);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 4px solid #ffb347;
  background: radial-gradient(circle, rgb(255 232 156 / .42), transparent 70%);
  transform: translate(-50%, -50%) scale(.25);
  animation: shockwave 420ms cubic-bezier(.16, 1, .3, 1) forwards;
}
.power-wave-mega { border-color: #ff6ea8; border-width: 5px; }
.power-wave-seeker {
  border-color: #20bfa1;
  background: radial-gradient(circle, rgb(137 245 220 / .44), transparent 70%);
}
.prism-pulse {
  width: var(--wave-size, 220px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(from 0deg, rgb(255 132 182 / .48), rgb(255 198 74 / .48), rgb(91 216 176 / .48), rgb(147 111 244 / .48), rgb(255 132 182 / .48));
  transform: translate(-50%, -50%) scale(.2);
  animation: prism-ring 520ms cubic-bezier(.16, 1, .3, 1) forwards;
}
.confetti {
  width: 9px;
  height: 12px;
  border-radius: 3px;
  background: var(--pop-color);
  animation: confetti-fall 900ms cubic-bezier(.18, .82, .38, 1) both;
}
.points { color: #331d62; text-shadow: 1px 1px white, -1px 1px white, 1px -1px white, -1px -1px white; font: 800 1.65rem/1 var(--display); animation: points 700ms ease-out forwards; }
:root[data-theme="night"] .points { color: #fff6ff; text-shadow: 0 2px 10px rgb(15 7 34 / .95), 0 0 2px #130d25; }
.combo-points { color: #7c214a; }
:root[data-theme="night"] .combo-points { color: #ffb3d2; }
.burst-name { display: block; margin-bottom: 3px; font-size: 1rem; white-space: nowrap; }
.pop-echo { pointer-events: none; z-index: 4; }
.board-well[data-view="iso"] .pop-echo { translate: 0 0 calc(var(--pedestal-depth) + var(--explode-gap) + 8px); }
.board-well[data-view="iso"] .pop-echo::after { pointer-events: none; }
.pop-echo .prism-wall { pointer-events: none; }
@keyframes sparkle { to { transform: translate(var(--dx), var(--dy)) rotate(130deg) scale(.2); opacity: 0; } }
@keyframes ice-burst {
  0% { transform: translate(-50%, -50%) rotate(45deg) scale(.6); opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) rotate(165deg) scale(.25); opacity: 0; }
}
@keyframes beam-flash {
  0% { opacity: 0; filter: brightness(1.4); }
  25% { opacity: .95; }
  100% { opacity: 0; }
}
@keyframes shockwave {
  0% { transform: translate(-50%, -50%) scale(.2); opacity: .95; }
  100% { transform: translate(-50%, -50%) scale(1.1); opacity: 0; }
}
@keyframes prism-ring {
  0% { transform: translate(-50%, -50%) scale(.18) rotate(0deg); opacity: .95; }
  100% { transform: translate(-50%, -50%) scale(1.15) rotate(120deg); opacity: 0; }
}
@keyframes confetti-fall {
  0% { transform: translate(0, 0) rotate(0deg) scale(.7); opacity: 1; }
  75% { opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)) scale(.9); opacity: 0; }
}
@keyframes points {
  0% { transform: translate(-50%, -50%) scale(.7); opacity: 0; }
  19% { opacity: 1; }
  65% { opacity: 1; }
  100% { transform: translate(-50%, -185%) scale(1.08); opacity: 0; }
}
@keyframes nudge { 25% { transform: translateX(-5%); } 70% { transform: translateX(5%); } }
.field-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px 12px;
  flex-wrap: wrap;
}
.booster-dock {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.booster-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 44px;
  min-height: 44px;
  padding: 5px 9px;
  border: 1px solid var(--control-edge);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--elev);
  font-size: .82rem;
  font-weight: 800;
  transition: background-color 140ms, border-color 140ms, color 140ms, transform 120ms, box-shadow 140ms;
}
.booster-btn:enabled:hover { background: var(--hover); border-color: var(--accent); }
.booster-btn:enabled:active { transform: translateY(1px) scale(.96); }
.booster-btn:disabled { opacity: .46; box-shadow: none; }
.booster-btn[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 30%, transparent);
}
.booster-icon {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  flex: none;
}
.booster-icon svg { display: block; width: 15px; height: 15px; }
.booster-icon-hammer { color: #b52b59; background: #ffe4ee; }
.booster-icon-swap { color: #11755c; background: #daf5ea; }
.booster-icon-shuffle { color: #5b36c5; background: #ebe1ff; }
.booster-icon-color { color: #a95f04; background: #fff0cc; }
:root[data-theme="dusk"] .booster-icon-hammer { color: #a42d22; background: #ffe2d8; }
:root[data-theme="dusk"] .booster-icon-swap { color: #156e57; background: #daf3e6; }
:root[data-theme="dusk"] .booster-icon-shuffle { color: #7e3727; background: #fae0d4; }
:root[data-theme="dusk"] .booster-icon-color { color: #9c5607; background: #ffecd0; }
:root[data-theme="night"] .booster-icon-hammer { color: #ff9bbf; background: #4a2138; }
:root[data-theme="night"] .booster-icon-swap { color: #7beed0; background: #1a3f38; }
:root[data-theme="night"] .booster-icon-shuffle { color: #d3bbff; background: #3b295e; }
:root[data-theme="night"] .booster-icon-color { color: #ffd470; background: #453318; }
.booster-btn[aria-pressed="true"] .booster-icon {
  color: var(--on-accent);
  background: rgb(255 255 255 / .22);
}
:root[data-theme="night"] .booster-btn[aria-pressed="true"] .booster-icon {
  background: rgb(25 14 44 / .24);
}
.booster-name { line-height: 1.1; white-space: nowrap; }
.booster-count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding-inline: 5px;
  border-radius: 999px;
  background: var(--tint);
  color: var(--ink);
  font-size: .74rem;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.booster-btn[aria-pressed="true"] .booster-count {
  background: rgb(255 255 255 / .24);
  color: var(--on-accent);
}
:root[data-theme="night"] .booster-btn[aria-pressed="true"] .booster-count {
  background: rgb(25 14 44 / .28);
}
.board-well:has(.board[data-booster]:not([data-booster=""])) {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent);
}
.board[data-booster="hammer"] .tile,
.board[data-booster="freeSwap"] .tile:not([data-blocker]),
.board[data-booster="colorBomb"] .tile:not([data-blocker="ice"]):not([data-blocker="crate"]):not([data-blocker="spread"]) {
  cursor: crosshair;
}
.board[data-booster="freeSwap"] .tile[data-blocker],
.board[data-booster="colorBomb"] .tile:is([data-blocker="ice"], [data-blocker="crate"], [data-blocker="spread"]) {
  cursor: not-allowed;
}
.tile.booster-origin { z-index: 3; }
.tile.booster-origin::after {
  border: 2.5px solid var(--accent);
  box-shadow: inset 0 0 0 2px #fff, 0 0 12px color-mix(in srgb, var(--accent) 52%, transparent);
}
.tile.booster-ready { z-index: 2; }
.tile.booster-ready::after {
  border: 2px dashed var(--accent);
  box-shadow: inset 0 0 0 1.5px rgb(255 255 255 / .75);
}
.game-feedback {
  flex: 1 1 210px;
  display: flex;
  align-items: center;
  align-content: center;
  flex-wrap: wrap;
  min-height: 44px;
  column-gap: 12px;
}
.field-message { color: var(--muted); font-size: .875rem; font-weight: 650; text-wrap: pretty; }
.field-message[data-tone="combo"],
.field-message[data-tone="power"] { color: var(--heat-text); font-weight: 750; }
.field-message[data-tone="ice"] { color: var(--ice-text); font-weight: 750; }
.guide-skip {
  min-height: 44px;
  padding: 0 4px;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: .875rem;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.turn-button.guide-start { outline: 2px solid var(--ready-border); outline-offset: 2px; }
.turn-button.guide-start:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
.dialog {
  width: min(440px, calc(100% - 32px));
  max-height: calc(100% - 32px);
  padding: clamp(20px, 6vw, 30px);
  border: 1px solid var(--control-edge);
  border-radius: 22px;
  background: var(--page);
  color: var(--ink);
  box-shadow: 0 18px 40px rgb(16 8 38 / .34);
  opacity: 0;
  transition-property: opacity, transform, display, overlay;
  transition-duration: 200ms;
  transition-timing-function: cubic-bezier(.16, 1, .3, 1);
  transition-behavior: allow-discrete;
}
@media (prefers-reduced-motion: no-preference) {
  .dialog { transform: translateY(8px) scale(.96); }
}
.dialog[open] {
  opacity: 1;
}
@starting-style {
  .dialog[open] { opacity: 0; }
}
@media (prefers-reduced-motion: no-preference) {
  .dialog[open] { transform: translateY(0) scale(1); }
  @starting-style {
    .dialog[open] { transform: translateY(8px) scale(.96); }
  }
}
.dialog:modal { overscroll-behavior: contain; }
.dialog::backdrop {
  overflow: hidden;
  overscroll-behavior: contain;
  background: transparent;
  backdrop-filter: blur(0px);
  transition-property: background-color, backdrop-filter, display, overlay;
  transition-duration: 200ms;
  transition-timing-function: ease-out;
  transition-behavior: allow-discrete;
}
.dialog[open]::backdrop {
  background: var(--backdrop);
  backdrop-filter: blur(3px);
}
@starting-style {
  .dialog[open]::backdrop {
    background: transparent;
    backdrop-filter: blur(0px);
  }
}
.dialog h2 { margin: 10px 0; font: 800 2.1rem/.97 var(--display); letter-spacing: -.037em; }
.dialog p, .dialog ol { color: var(--muted); font-size: .92rem; text-wrap: pretty; }
.dialog ol { margin: 12px 0; padding-left: 20px; }
.dialog li + li { margin-top: 7px; }
.dialog .help-rules h3 { margin: 16px 0 0; font: 800 1.15rem/1.2 var(--display); }
.dialog .help-rules ol { margin-top: 8px; }
.dialog .help-rules ~ p + p { margin-top: 8px; }
.help-shortcuts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}
.help-shortcuts span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border: 1px solid var(--edge);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: .78rem;
  font-weight: 700;
}
.help-shortcuts kbd {
  padding: 1px 5px;
  border: 1px solid var(--control-edge);
  border-radius: 5px;
  background: var(--tint);
  color: var(--ink);
  font: 800 .74rem/1.2 var(--body);
}
.dialog .primary-button { margin-top: 19px; }
.dialog-close { position: absolute; right: 15px; top: 15px; font-size: 1.35rem; }
.dialog-mark {
  display: inline-grid;
  place-items: center;
  width: 51px;
  height: 51px;
  border-radius: 14px;
  color: var(--accent);
  background: var(--tint);
  font: 800 1.8rem/1 var(--display);
}
.dialog-mark[data-outcome="cleared"] {
  color: var(--star-gold);
  background: color-mix(in srgb, var(--star-gold) 16%, var(--surface));
}
.result-stars {
  display: flex;
  gap: 6px;
  margin: 4px 0 8px;
  font-size: 1.75rem;
  line-height: 1;
}
.result-star { color: var(--star-empty); }
.result-star.earned {
  color: var(--star-gold);
  animation: star-pop 340ms cubic-bezier(.16, 1.3, .3, 1) calc(var(--star-index, 0) * 90ms) both;
}
@keyframes star-pop {
  0% { transform: scale(.3) rotate(-18deg); opacity: 0; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}
.result-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 8px;
  margin-top: 14px;
}
.result-stat {
  display: grid;
  gap: 2px;
  padding: 9px 11px;
  border: 1px solid var(--edge);
  border-radius: 11px;
  background: var(--surface);
}
.result-stat span { color: var(--muted); font-size: .75rem; font-weight: 700; }
.result-stat strong { color: var(--ink); font: 800 1.12rem/1.1 var(--display); font-variant-numeric: tabular-nums; }
.result-reward {
  margin-top: 12px;
  padding: 8px 12px;
  border: 1px solid var(--ready-border);
  border-radius: 11px;
  background: var(--ready-bg);
  color: var(--ready-text);
  font-size: .86rem;
  font-weight: 800;
  text-align: center;
}
.dialog-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 19px; }
.dialog-actions .primary-button { margin: 0; }
.dialog-actions .quiet-button { min-height: 49px; }
.level-map { width: min(540px, calc(100% - 24px)); }
.level-map h2 { margin-inline-end: 40px; }
.map-head-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.map-jump { min-height: 36px; padding: 0 10px; font-size: .8rem; border-radius: 9px; }
.map-jump:disabled { opacity: .48; }
.map-filter { display: grid; gap: 6px; margin-top: 12px; color: var(--muted); font-size: .85rem; font-weight: 750; }
.map-filter select {
  min-height: 44px;
  width: 100%;
  padding: 7px 10px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--control-edge);
  border-radius: 10px;
  font: inherit;
  font-size: 1rem;
}
.map-filter select:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.map-chapter-bar {
  display: grid;
  gap: 5px;
  margin-top: 10px;
  color: var(--muted);
  font-size: .8rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}
.map-chapter-bar progress { margin-top: 0; height: 6px; }
.map-stages {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(52px, 1fr));
  gap: 6px;
  max-height: min(44svh, 430px);
  overflow: auto;
  margin-block: 10px;
  padding: 5px;
}
.map-stages button {
  display: grid;
  place-content: center;
  gap: 1px;
  min-height: 46px;
  padding: 3px;
  border: 1px solid var(--control-edge);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink);
  font-size: .82rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  transition: background-color 120ms, border-color 120ms, transform 120ms;
}
.map-stages button:not(:disabled):hover { background: var(--hover); border-color: var(--accent); }
.map-stages button:not(:disabled):active { transform: scale(.96); }
.stage-num { line-height: 1.05; }
.stage-stars { font-size: .56rem; line-height: 1; letter-spacing: .5px; color: var(--star-gold); }
.map-stages button[data-state="cleared"], .map-done { background: var(--tint); border-color: color-mix(in srgb, var(--accent) 45%, var(--edge)); }
.map-open { background: var(--surface); border-color: var(--accent) !important; box-shadow: inset 0 0 0 1px var(--accent); }
.map-stages button:disabled, .map-lock { border-color: var(--edge); background: transparent; color: var(--muted); opacity: .7; }
.map-stages button[aria-current] { border-color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); }
.map-stages button:focus-visible { outline-offset: 1px; }
.map-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.map-legend span { width: 12px; height: 12px; border: 1px solid var(--control-edge); border-radius: 3px; }
.map-legend span:not(:first-child) { margin-inline-start: 7px; }
.theme-options { display: grid; gap: 7px; padding: 0; border: 0; margin: 17px 0 0; }
.theme-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  min-height: 48px;
  padding: 7px 10px;
  border: 1px solid var(--control-edge);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 750;
  cursor: pointer;
}
.theme-option:hover { background: var(--hover); }
.theme-option:has(input:checked) { border-color: var(--accent); background: var(--tint); }
.theme-option input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.theme-option input:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; }
.theme-option[data-choice="candy"] { --swatch-a: #dccaff; --swatch-b: #ffd5e8; --swatch-c: #8255eb; }
.theme-option[data-choice="dusk"] { --swatch-a: #ffe0b4; --swatch-b: #ffba9d; --swatch-c: #a23e2d; }
.theme-option[data-choice="night"] { --swatch-a: #251a39; --swatch-b: #51426c; --swatch-c: #c5a6ff; }
.theme-sample {
  width: 42px;
  height: 26px;
  border-radius: 5px;
  border: 1px solid var(--control-edge);
  background: linear-gradient(116deg, var(--swatch-a) 35%, var(--swatch-b) 35% 66%, var(--swatch-c) 66%);
}
.sr-only { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }

@media (min-width: 651px) and (max-height: 820px) {
  .board-well[data-view="iso"] {
    --iso-default: 56.5;
    --iso-tilt: 56.5deg;
    --emoji-stretch: 1.66;
    aspect-ratio: 1.82;
  }
}
@media (max-width: 650px) {
  .main-menu { grid-template-columns: minmax(0, 1fr); gap: 22px; padding-block: 25px 12px; }
  .menu-copy { padding-inline: clamp(6px, 4vw, 28px); }
  .menu-copy h1 { font-size: clamp(3.65rem, 12vw, 5.4rem); line-height: .86; }
  .menu-copy h1 span { display: inline; }
  .mode-picker { grid-template-columns: minmax(0, 1fr); max-width: none; }
  .mode-option:not(.mode-option-featured) .mode-button {
    grid-template-columns: 42px minmax(0, 1fr) auto;
    grid-template-rows: auto;
    align-items: center;
    gap: 11px;
  }
  .mode-option:not(.mode-option-featured) .mode-icon { width: 42px; }
  .mode-option:not(.mode-option-featured) .mode-arrow,
  .mode-option:not(.mode-option-featured) .mode-copy {
    grid-column: auto;
    grid-row: auto;
  }
  .menu-art { min-height: clamp(218px, 64vw, 335px); }
  .menu-tray { width: min(64%, 305px); }
  .topbar { grid-template-columns: minmax(max-content, 1fr) auto auto; }
  .help-label { display: none; }
  .top-actions .help-button { padding: 0; }
  .field-top {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "level moves" "score next";
    column-gap: 12px;
    align-items: end;
  }
}
@media (max-width: 540px) {
  .shell, body[data-screen="menu"] .shell { width: calc(100% - 20px); padding-block-start: 8px; }
  .topbar { min-height: 57px; padding: 4px 6px; gap: 6px; }
  .brand-mark { width: 29px; height: 29px; }
  .view-switch button { padding-inline: 7px; }
  .view-icon { display: none; }
  .view-full { display: none; }
  .view-short { display: inline; }
  .field-top { padding: 7px 8px; gap: 6px 8px; align-items: center; }
  .level-title { gap: 5px; }
  #level-number { width: 25px; height: 24px; }
  .stat { justify-content: flex-end; }
  .next-preview { gap: 5px; padding: 3px 4px 3px 6px; }
  .next-item { width: 24px; }
  .next-item:first-child { width: 29px; }
  .score-total strong, .stat strong { font-size: 1.1rem; }
  .target-head { column-gap: 4px; row-gap: 0; }
  .target-head > span { white-space: nowrap; }
  .board-well {
    width: calc(100% + 8px);
    margin-inline: -4px;
    border-radius: 13px;
  }
  .board-well[data-view="flat"] {
    width: calc(100% + 8px);
    margin-inline: -4px;
  }
  .board-well[data-view="iso"] {
    --iso-default: 39;
    --iso-tilt: 39deg;
    --emoji-stretch: 1.18;
    aspect-ratio: 1.29;
  }
  .board-well[data-view="iso"] .board { width: calc(69% - 13px); }
  .board-well[data-view="iso"] .ambient-props { display: none; }
  .burst-banner { top: 8px; padding: 5px 12px; font-size: .78rem; }
  .field-bottom { gap: 6px; }
  .objectives { line-height: 1.2; }
  .controls { width: 100%; }
  .turn-button { flex: 1; }
  .booster-dock {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: 100%;
    gap: 5px;
  }
  .booster-btn {
    position: relative;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    min-height: 48px;
    padding: 6px 4px 5px;
    font-size: .76rem;
  }
  .booster-count {
    position: absolute;
    top: 3px;
    right: 4px;
    min-width: 17px;
    height: 17px;
    padding-inline: 4px;
    font-size: .68rem;
  }
}
@media (max-width: 400px) {
  .topbar { gap: 4px; }
  .menu-home { padding: 0; }
  .menu-home-label { display: none; }
  .menu-home .back-mark { margin-inline-start: 3px; }
  body[data-mode="pop"] .controls { display: grid; grid-template-columns: minmax(0, 1fr) auto 44px; gap: 4px; }
  .controls .quiet-button { padding-inline: 6px; }
  .controls .turn-button { gap: 3px; padding-inline: 4px; }
  .controls :is(.turn-button, .turn-label) { min-width: 0; white-space: normal; }
  .controls .turn-icon { display: none; }
  .controls .energy { padding-inline: 4px; }
  .controls button:focus-visible { outline-offset: 1px; }
  .booster-dock { gap: 4px; }
  .booster-btn { padding: 5px 2px 4px; font-size: .73rem; }
  .booster-icon { width: 20px; height: 20px; }
  .booster-icon svg { width: 14px; height: 14px; }
  .menu-copy h1 { font-size: clamp(3.15rem, 12vw, 4.45rem); }
  .mode-button { gap: 9px; padding: 10px; }
  .top-actions { gap: 2px; }
  .view-switch { padding: 2px; gap: 1px; }
  .view-switch button { padding-inline: 5px; }
  .next-preview { flex-wrap: wrap; justify-content: center; width: 146px; gap: 3px; }
  .next-preview > span { flex-basis: 100%; text-align: center; }
  body[data-mode="match"] .next-preview,
  body[data-mode="special"] .next-preview { width: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: 0s !important; }
  .expression, .stat strong.low, .tile[data-power] .face::before, .ambient-prop .prop-body, .ambient-prop .prop-shadow { animation: none !important; }
  .ambient-props { display: none !important; }
  .burst-banner.is-popping { animation: none !important; }
  .dialog, .dialog::backdrop { transition-duration: 100ms !important; }
}
