:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: #31414b;
  background: #eef9ff;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  --paper: #ffffff;
  --panel: rgba(255, 255, 255, 0.9);
  --ink: #31414b;
  --muted: #667782;
  --line: #bfe6ef;
  --soft-line: #e8f5f8;
  --accent: #ff8d36;
  --accent-dark: #de681f;
  --gold: #ffd35a;
  --gold-dark: #e9a52f;
  --leaf: #67bf66;
  --leaf-dark: #3c9a4a;
  --wood: #d9873c;
  --wood-dark: #a95b2d;
  --warn: #e85f58;
  --sky: #dff7ff;
  --grass: #e7f8dc;
  --shadow: 0 18px 38px rgba(37, 94, 112, 0.16);
  --pop-shadow: 0 10px 20px rgba(143, 86, 33, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
}

button {
  font: inherit;
}

.app-shell {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(14px, 2.8vw, 30px);
  overflow: hidden;
  background:
    linear-gradient(180deg, #c8f2ff 0%, #eefbff 48%, #f9f6d6 69%, #dff4b4 100%);
}

.scene-layer,
.scene-layer span {
  position: absolute;
  pointer-events: none;
}

.scene-layer {
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.scene-cloud {
  width: clamp(120px, 16vw, 220px);
  height: clamp(36px, 5vw, 66px);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 12px 26px rgba(98, 165, 190, 0.1);
}

.scene-cloud::before,
.scene-cloud::after {
  content: "";
  position: absolute;
  bottom: 28%;
  border-radius: 999px 999px 0 0;
  background: inherit;
}

.scene-cloud::before {
  left: 16%;
  width: 34%;
  height: 92%;
}

.scene-cloud::after {
  right: 18%;
  width: 40%;
  height: 116%;
}

.cloud-one {
  top: 9%;
  left: 7%;
}

.cloud-two {
  top: 15%;
  right: 9%;
  transform: scale(0.82);
  opacity: 0.74;
}

.scene-hill {
  left: -8%;
  right: -8%;
  bottom: -10%;
  height: 34%;
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
}

.hill-back {
  bottom: 4%;
  background: linear-gradient(180deg, #bce98b 0%, #8fd46c 100%);
  opacity: 0.82;
}

.hill-front {
  bottom: -8%;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 22%),
    linear-gradient(180deg, #9dde67 0%, #5fb955 100%);
}

.scene-row {
  bottom: -2%;
  width: 46%;
  height: 18%;
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
  border-top: 3px solid rgba(255, 255, 255, 0.38);
  opacity: 0.45;
}

.row-one {
  left: 3%;
  transform: rotate(-7deg);
  background: repeating-linear-gradient(110deg, rgba(43, 137, 60, 0.16) 0 14px, transparent 14px 42px);
}

.row-two {
  right: -2%;
  transform: rotate(8deg);
  background: repeating-linear-gradient(70deg, rgba(43, 137, 60, 0.14) 0 14px, transparent 14px 42px);
}

.game-stage {
  position: relative;
  z-index: 1;
  width: min(1080px, 100%);
  display: grid;
  gap: 14px;
}

.game-hud,
.target-panel,
.level-panel {
  border: 2px solid rgba(255, 255, 255, 0.8);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(245, 253, 255, 0.9)),
    var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.game-hud {
  min-height: 78px;
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto 48px;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 8px;
  box-shadow:
    inset 0 -4px 0 rgba(80, 169, 189, 0.12),
    var(--shadow);
}

.level-copy h1,
.panel-heading h2,
.end-dialog h2 {
  margin: 0;
  letter-spacing: 0;
}

.level-copy h1 {
  margin-top: 4px;
  color: #24505f;
  font-size: clamp(24px, 3.2vw, 36px);
  line-height: 1;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.64);
}

.eyebrow {
  display: block;
  color: #5e8794;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.hud-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(92px, 1fr));
  gap: 8px;
}

.metric {
  position: relative;
  overflow: hidden;
  min-height: 50px;
  display: grid;
  align-content: center;
  gap: 3px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.94);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(234, 250, 255, 0.82)),
    #eafaff;
  box-shadow:
    inset 0 -3px 0 rgba(83, 169, 188, 0.1),
    0 7px 14px rgba(37, 94, 112, 0.08);
}

.metric::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: #69cfda;
}

.metric-moves::before {
  background: #ffb238;
}

.metric-score::before {
  background: #43c95b;
}

.metric.message::before {
  background: #ff8fca;
}

.metric span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.metric strong {
  color: var(--ink);
  font-size: 19px;
  line-height: 1.1;
  white-space: nowrap;
}

.metric.message strong {
  max-width: 122px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.icon-button,
.level-dots button,
.board-cell,
.primary-button,
.secondary-button {
  border: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.icon-button {
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  color: #ffffff;
  background:
    linear-gradient(180deg, #ffae57, #f07a2a),
    var(--accent);
  box-shadow:
    inset 0 -4px 0 rgba(140, 67, 20, 0.18),
    var(--pop-shadow);
}

.icon-button:hover,
.level-dots button:hover,
.primary-button:hover,
.secondary-button:hover {
  transform: translateY(-1px);
}

.play-area {
  display: grid;
  grid-template-columns: minmax(320px, 610px) minmax(240px, 300px);
  align-items: start;
  justify-content: center;
  gap: 16px;
}

.board-wrap {
  position: relative;
  padding: clamp(12px, 1.9vw, 18px);
  border: 2px solid rgba(255, 255, 255, 0.86);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 244, 176, 0.96), rgba(245, 164, 79, 0.95)),
    var(--gold);
  box-shadow:
    inset 0 -8px 0 rgba(160, 86, 32, 0.16),
    0 22px 36px rgba(94, 89, 42, 0.2);
}

.board-wrap::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.52);
  pointer-events: none;
}

.board-wrap::after {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: -10px;
  height: 18px;
  border-radius: 0 0 8px 8px;
  background: rgba(119, 73, 36, 0.18);
  filter: blur(1px);
  z-index: -1;
}

.game-board {
  width: min(600px, calc(100vw - 48px), calc(100vh - 186px));
  max-width: 100%;
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  grid-template-rows: repeat(8, minmax(0, 1fr));
  gap: clamp(5px, 0.85vw, 7px);
  padding: clamp(6px, 1vw, 9px);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.22), transparent 36%),
    #75cfe0;
  box-shadow:
    inset 0 0 0 2px rgba(46, 129, 153, 0.12),
    inset 0 8px 18px rgba(255, 255, 255, 0.22);
}

.board-cell {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), transparent 50%),
    #e5faff;
  box-shadow:
    inset 0 -4px 0 rgba(73, 166, 190, 0.12),
    inset 0 0 0 1px rgba(255, 255, 255, 0.72),
    0 2px 4px rgba(43, 91, 114, 0.08);
  transition:
    transform 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

.board-cell:disabled {
  cursor: default;
}

.board-cell.is-selected {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.84), transparent 52%),
    #fff2a6;
  box-shadow:
    inset 0 0 0 3px #ff8d36,
    inset 0 -4px 0 rgba(221, 112, 24, 0.12),
    0 10px 18px rgba(255, 141, 54, 0.22);
  transform: translateY(-2px) scale(1.02);
}

.board-cell.is-invalid {
  animation: cell-shake 260ms ease;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.8), transparent 52%),
    #ffd3ce;
}

.board-cell.is-clearing {
  z-index: 2;
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.98) 0 34%, rgba(255, 238, 182, 0.9) 62%, rgba(238, 248, 251, 0.8) 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 180, 72, 0.26),
    0 0 0 5px rgba(255, 180, 72, 0.14),
    0 14px 24px rgba(255, 141, 54, 0.2);
}

.board-cell.is-clearing .piece {
  animation: piece-clear 520ms cubic-bezier(0.16, 0.9, 0.22, 1) forwards;
}

.piece {
  width: 80%;
  height: 80%;
  display: grid;
  place-items: center;
  filter: drop-shadow(0 7px 5px rgba(43, 60, 72, 0.2));
  animation: piece-in 190ms cubic-bezier(0.2, 0.85, 0.32, 1.2) both;
}

.clear-burst {
  position: absolute;
  inset: -24%;
  z-index: 3;
  pointer-events: none;
  color: var(--burst-color);
}

.burst-ring {
  position: absolute;
  inset: 18%;
  border: 3px solid currentColor;
  border-radius: 999px;
  opacity: 0;
  box-shadow:
    0 0 0 4px rgba(255, 255, 255, 0.5),
    0 0 18px currentColor;
  animation: burst-ring 500ms ease-out forwards;
}

.burst-star {
  position: absolute;
  top: 50%;
  left: 50%;
  width: clamp(8px, 1.4vw, 14px);
  height: clamp(8px, 1.4vw, 14px);
  background: #ffffff;
  clip-path: polygon(50% 0, 62% 35%, 100% 50%, 62% 65%, 50% 100%, 38% 65%, 0 50%, 38% 35%);
  filter: drop-shadow(0 0 5px currentColor);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.36) rotate(0deg);
  animation: burst-star 500ms ease-out var(--delay) forwards;
}

.burst-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: clamp(4px, 0.75vw, 7px);
  height: clamp(4px, 0.75vw, 7px);
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.72);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.5);
  animation: burst-dot 460ms ease-out var(--delay) forwards;
}

.animal-body {
  position: relative;
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 42% 42% 46% 46%;
  transform-origin: center bottom;
  transition: transform 160ms ease;
}

.animal-body::before,
.animal-body::after,
.animal-face::before,
.animal-face::after,
.animal-ear,
.animal-cheek,
.animal-eye,
.animal-nose,
.animal-mouth {
  content: "";
  position: absolute;
  display: block;
}

.animal-body::after {
  top: 14%;
  left: 19%;
  width: 25%;
  height: 15%;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.42);
  transform: rotate(-22deg);
}

.board-cell:hover .animal-body {
  transform: translateY(-2px) scale(1.06);
}

.animal-face {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
}

.animal-eye {
  top: 37%;
  width: 13.5%;
  height: 15%;
  border-radius: 999px;
  background: #24323b;
  z-index: 2;
}

.animal-eye::before,
.animal-eye::after {
  content: "";
  position: absolute;
  border-radius: inherit;
}

.animal-eye::before {
  right: 18%;
  bottom: 17%;
  width: 17%;
  height: 17%;
  background: rgba(255, 255, 255, 0.38);
}

.animal-eye::after {
  top: 13%;
  left: 17%;
  width: 34%;
  height: 34%;
  background: rgba(255, 255, 255, 0.82);
}

.animal-eye-left {
  left: 30%;
}

.animal-eye-right {
  right: 30%;
}

.animal-cheek {
  top: 53%;
  width: 13%;
  height: 8%;
  border-radius: 999px;
  background: rgba(255, 116, 132, 0.34);
  z-index: 1;
}

.animal-cheek-left {
  left: 19%;
  transform: rotate(8deg);
}

.animal-cheek-right {
  right: 19%;
  transform: rotate(-8deg);
}

.animal-nose {
  top: 53%;
  left: 50%;
  width: 8.5%;
  height: 7%;
  border-radius: 999px;
  background: rgba(38, 52, 59, 0.82);
  transform: translateX(-50%);
  z-index: 2;
}

.animal-mouth {
  top: 61%;
  left: 50%;
  width: 18%;
  height: 10%;
  border-bottom: 2px solid rgba(38, 52, 59, 0.68);
  border-radius: 0 0 999px 999px;
  transform: translateX(-50%);
  z-index: 2;
}

.animal-ear {
  z-index: -1;
  background: inherit;
}

.animal-ear-left {
  left: 14%;
}

.animal-ear-right {
  right: 14%;
}

.piece-circle .animal-body {
  border-radius: 48% 48% 47% 47%;
  background:
    radial-gradient(circle at 32% 24%, rgba(255, 255, 255, 0.42), transparent 18%),
    linear-gradient(180deg, #ffd36a 0%, #ffb238 76%, #e88720 100%);
  box-shadow:
    inset 0 -5px 0 rgba(174, 92, 22, 0.22),
    inset 0 2px 0 rgba(255, 255, 255, 0.28);
}

.piece-circle .animal-ear {
  top: -7%;
  width: 28%;
  height: 28%;
  border-radius: 7px 80% 7px 80%;
}

.piece-circle .animal-ear::after,
.piece-diamond .animal-ear::after,
.piece-triangle .animal-ear::after {
  content: "";
  position: absolute;
  display: block;
}

.piece-circle .animal-ear::after {
  inset: 24% 22% 18%;
  border-radius: inherit;
  background: rgba(255, 240, 205, 0.5);
}

.piece-circle .animal-ear-left {
  transform: rotate(-34deg);
}

.piece-circle .animal-ear-right {
  transform: rotate(34deg) scaleX(-1);
}

.piece-circle .animal-face::before,
.piece-circle .animal-face::after {
  top: 54%;
  width: 14%;
  height: 2px;
  border-radius: 999px;
  background: rgba(38, 52, 59, 0.46);
}

.piece-circle .animal-face::before {
  left: 15%;
  transform: rotate(10deg);
}

.piece-circle .animal-face::after {
  right: 15%;
  transform: rotate(-10deg);
}

.piece-diamond .animal-body {
  border-radius: 50% 50% 45% 45%;
  background:
    radial-gradient(circle at 34% 25%, rgba(255, 255, 255, 0.42), transparent 18%),
    linear-gradient(180deg, #ff955f 0%, #ff6b2f 74%, #d84a1f 100%);
  box-shadow:
    inset 0 -5px 0 rgba(143, 50, 22, 0.22),
    inset 0 2px 0 rgba(255, 255, 255, 0.28);
}

.piece-diamond .animal-ear {
  top: -9%;
  width: 29%;
  height: 30%;
  border-radius: 8px 80% 8px 80%;
}

.piece-diamond .animal-ear::after {
  inset: 25% 22% 18%;
  border-radius: inherit;
  background: rgba(255, 236, 211, 0.52);
}

.piece-diamond .animal-ear-left {
  transform: rotate(-38deg);
}

.piece-diamond .animal-ear-right {
  transform: rotate(38deg) scaleX(-1);
}

.piece-diamond .animal-body::before {
  left: 50%;
  bottom: 10%;
  width: 36%;
  height: 24%;
  border-radius: 50% 50% 46% 46%;
  background: rgba(255, 242, 221, 0.88);
  transform: translateX(-50%);
}

.piece-triangle .animal-body {
  border-radius: 50% 50% 51% 51%;
  background:
    radial-gradient(circle at 34% 25%, rgba(255, 255, 255, 0.48), transparent 18%),
    linear-gradient(180deg, #ffc3e1 0%, #ff8fca 76%, #e35c9f 100%);
  box-shadow:
    inset 0 -5px 0 rgba(153, 55, 102, 0.2),
    inset 0 2px 0 rgba(255, 255, 255, 0.32);
}

.piece-triangle .animal-ear {
  top: -26%;
  width: 21%;
  height: 43%;
  border-radius: 999px 999px 44% 44%;
}

.piece-triangle .animal-ear::after {
  inset: 16% 26% 18%;
  border-radius: inherit;
  background: rgba(255, 245, 251, 0.62);
}

.piece-triangle .animal-ear-left {
  left: 27%;
  transform: rotate(-10deg);
}

.piece-triangle .animal-ear-right {
  right: 27%;
  transform: rotate(10deg);
}

.piece-triangle .animal-nose {
  width: 8%;
  background: #c94f8b;
}

.piece-triangle .animal-cheek {
  background: rgba(235, 65, 136, 0.26);
}

.piece-square .animal-body {
  border-radius: 50% 50% 46% 46%;
  background:
    radial-gradient(circle at 32% 24%, rgba(255, 255, 255, 0.46), transparent 18%),
    linear-gradient(180deg, #ffffff 0%, #e9f4ff 70%, #cbd9ed 100%);
  box-shadow:
    inset 0 -5px 0 rgba(74, 91, 118, 0.2),
    inset 0 2px 0 rgba(255, 255, 255, 0.36);
}

.piece-square .animal-ear {
  top: 3%;
  width: 25%;
  height: 25%;
  border-radius: 999px;
  background: #4f5f75;
}

.piece-square .animal-ear-left {
  left: 5%;
}

.piece-square .animal-ear-right {
  right: 5%;
}

.piece-square .animal-eye {
  background: #25313b;
  box-shadow: 0 0 0 6px #4f5f75;
}

.piece-square .animal-cheek {
  top: 56%;
  background: rgba(255, 128, 145, 0.22);
}

.piece-square .animal-nose {
  background: #4f5f75;
}

.piece-hex .animal-body {
  border-radius: 51% 51% 49% 49%;
  background:
    radial-gradient(circle at 34% 24%, rgba(255, 255, 255, 0.44), transparent 18%),
    linear-gradient(180deg, #ffe760 0%, #ffd21f 72%, #e5aa00 100%);
  box-shadow:
    inset 0 -5px 0 rgba(149, 99, 0, 0.2),
    inset 0 2px 0 rgba(255, 255, 255, 0.32);
}

.piece-hex .animal-ear {
  display: none;
}

.piece-hex .animal-body::before {
  top: -7%;
  left: 50%;
  width: 22%;
  height: 16%;
  border-radius: 999px 999px 0 0;
  background: #e5aa00;
  transform: translateX(-50%);
}

.piece-hex .animal-nose {
  top: 51%;
  width: 0;
  height: 0;
  border-top: 7px solid #ff8a1f;
  border-right: 5px solid transparent;
  border-left: 5px solid transparent;
  border-radius: 0;
  background: transparent;
}

.piece-hex .animal-cheek {
  top: 52%;
  background: rgba(255, 112, 88, 0.24);
}

.piece-plus .animal-body {
  border-radius: 52% 52% 46% 46%;
  background:
    radial-gradient(circle at 34% 24%, rgba(255, 255, 255, 0.42), transparent 18%),
    linear-gradient(180deg, #8bf079 0%, #43c95b 72%, #249e38 100%);
  box-shadow:
    inset 0 -5px 0 rgba(23, 109, 40, 0.22),
    inset 0 2px 0 rgba(255, 255, 255, 0.32);
}

.piece-plus .animal-ear {
  top: -8%;
  width: 25%;
  height: 25%;
  border-radius: 999px;
}

.piece-plus .animal-eye {
  top: 35%;
}

.piece-plus .animal-nose {
  display: none;
}

.piece-plus .animal-mouth {
  top: 55%;
  width: 26%;
  height: 11%;
}

.piece-plus .animal-cheek {
  top: 50%;
  background: rgba(255, 250, 121, 0.24);
}

.side-panel {
  display: grid;
  gap: 12px;
}

.target-panel,
.level-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: 8px;
  box-shadow:
    inset 0 -4px 0 rgba(80, 169, 189, 0.1),
    var(--shadow);
}

.panel-heading h2 {
  margin-top: 2px;
  color: #24505f;
  font-size: 18px;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.72);
}

.target-list {
  display: grid;
  gap: 12px;
}

.target-row {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 44px 1fr;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(247, 253, 255, 0.72)),
    #edfaff;
  box-shadow:
    inset 0 -3px 0 rgba(67, 154, 174, 0.08),
    0 8px 14px rgba(37, 94, 112, 0.08);
}

.target-row::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--target-color);
}

.target-row .piece {
  width: 40px;
  height: 40px;
}

.target-progress {
  display: grid;
  gap: 7px;
}

.target-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  color: var(--ink);
  font-size: 14px;
}

.target-label span {
  font-weight: 700;
}

.target-label strong {
  white-space: nowrap;
}

.progress-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.84), transparent),
    #d9eef4;
  box-shadow: inset 0 1px 3px rgba(57, 103, 116, 0.12);
}

.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.36),
    0 0 8px rgba(255, 255, 255, 0.48);
  transition: width 260ms ease;
}

.level-dots {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
}

.level-dots button {
  min-width: 0;
  height: 36px;
  border-radius: 8px;
  color: #3e6773;
  font-weight: 800;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(239, 250, 252, 0.86)),
    rgba(255, 255, 255, 0.9);
  box-shadow:
    inset 0 -3px 0 rgba(83, 169, 188, 0.1),
    inset 0 0 0 1px var(--soft-line);
  transition:
    transform 160ms ease,
    background 160ms ease,
    color 160ms ease;
}

.level-dots button.is-active {
  color: #7a4216;
  background:
    linear-gradient(180deg, #ffe27a, #ffb238),
    var(--gold);
  box-shadow:
    inset 0 -4px 0 rgba(160, 86, 32, 0.16),
    0 8px 14px rgba(255, 157, 45, 0.2);
}

.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(139, 210, 230, 0.24), rgba(57, 123, 91, 0.22)),
    rgba(43, 91, 114, 0.24);
  backdrop-filter: blur(12px);
}

.end-dialog {
  position: relative;
  overflow: hidden;
  width: min(380px, 100%);
  display: grid;
  gap: 20px;
  padding: 24px;
  border: 2px solid rgba(255, 255, 255, 0.88);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(251, 255, 239, 0.92)),
    var(--paper);
  box-shadow:
    inset 0 -5px 0 rgba(80, 169, 189, 0.12),
    0 28px 60px rgba(43, 91, 114, 0.26);
}

.result-mark {
  position: relative;
  width: 62px;
  height: 62px;
  border-radius: 999px;
  box-shadow:
    inset 0 -6px 0 rgba(85, 48, 15, 0.16),
    0 10px 18px rgba(84, 51, 20, 0.18);
}

.result-mark::before {
  content: "";
  position: absolute;
  inset: 17px 16px;
  border-radius: 4px;
}

.result-won {
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.54), transparent 28%),
    #5fd55e;
}

.result-won::before {
  border-right: 5px solid #ffffff;
  border-bottom: 5px solid #ffffff;
  transform: rotate(42deg) translate(-1px, -5px);
}

.result-lost {
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.54), transparent 28%),
    var(--warn);
}

.result-lost::before,
.result-lost::after {
  content: "";
  position: absolute;
  top: 29px;
  left: 17px;
  width: 28px;
  height: 5px;
  border-radius: 999px;
  background: #ffffff;
}

.result-lost::before {
  transform: rotate(45deg);
}

.result-lost::after {
  transform: rotate(-45deg);
}

.end-dialog h2 {
  margin-top: 4px;
  color: #24505f;
  font-size: 30px;
}

.dialog-copy {
  margin: 8px 0 0;
  color: var(--muted);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.primary-button,
.secondary-button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  border-radius: 8px;
  font-weight: 800;
  box-shadow:
    inset 0 -4px 0 rgba(63, 82, 87, 0.1),
    0 8px 14px rgba(37, 94, 112, 0.1);
  transition:
    transform 160ms ease,
    background 160ms ease;
}

.primary-button {
  color: #ffffff;
  background:
    linear-gradient(180deg, #ffaf56, #f07a2a),
    #ff8d36;
}

.secondary-button {
  color: #3e6773;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(238, 251, 253, 0.9)),
    #f4fbfd;
}

.dialog-sparkle {
  position: absolute;
  width: 16px;
  height: 16px;
  background: #ffd35a;
  clip-path: polygon(50% 0, 61% 36%, 100% 50%, 61% 64%, 50% 100%, 39% 64%, 0 50%, 39% 36%);
  opacity: 0.72;
  animation: sparkle-pulse 1300ms ease-in-out infinite;
}

.sparkle-one {
  top: 22px;
  right: 26px;
}

.sparkle-two {
  bottom: 34px;
  right: 70px;
  width: 11px;
  height: 11px;
  animation-delay: 260ms;
}

.sparkle-three {
  top: 72px;
  left: 28px;
  width: 12px;
  height: 12px;
  background: #9be971;
  animation-delay: 520ms;
}

@keyframes piece-in {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.84);
  }
  65% {
    transform: translateY(1px) scale(1.06);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes piece-clear {
  0% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
  38% {
    opacity: 1;
    transform: scale(1.16) rotate(-3deg);
  }
  72% {
    opacity: 0.72;
    transform: scale(0.72) rotate(4deg);
  }
  to {
    opacity: 0;
    transform: scale(0.22) rotate(10deg);
  }
}

@keyframes burst-ring {
  0% {
    opacity: 0.72;
    transform: scale(0.48);
  }
  64% {
    opacity: 0.38;
  }
  to {
    opacity: 0;
    transform: scale(1.55);
  }
}

@keyframes burst-dot {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.45);
  }
  28% {
    opacity: 1;
  }
  to {
    opacity: 0;
    transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y))) scale(1);
  }
}

@keyframes burst-star {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.36) rotate(0deg);
  }
  24% {
    opacity: 1;
  }
  to {
    opacity: 0;
    transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y))) scale(1.1) rotate(130deg);
  }
}

@keyframes sparkle-pulse {
  0%,
  100% {
    opacity: 0.38;
    transform: scale(0.82) rotate(0deg);
  }
  50% {
    opacity: 0.86;
    transform: scale(1.14) rotate(12deg);
  }
}

@keyframes cell-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-4px);
  }
  75% {
    transform: translateX(4px);
  }
}

@media (max-width: 860px) {
  .app-shell {
    align-items: flex-start;
    padding: 12px;
  }

  .game-hud {
    grid-template-columns: 1fr 48px;
  }

  .hud-metrics {
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, 1fr);
    order: 3;
  }

  .play-area {
    grid-template-columns: minmax(0, 1fr);
  }

  .side-panel {
    grid-template-columns: minmax(0, 1fr);
  }

  .game-board {
    width: 100%;
  }
}

@media (max-width: 520px) {
  .game-hud {
    gap: 12px;
    padding: 14px;
  }

  .level-copy h1 {
    font-size: 26px;
  }

  .hud-metrics {
    grid-template-columns: repeat(2, 1fr);
  }

  .metric.message {
    grid-column: 1 / -1;
  }

  .metric.message strong {
    max-width: none;
  }

  .board-wrap {
    padding: 9px;
  }

  .game-board {
    gap: 5px;
  }

  .board-cell {
    border-radius: 11px;
  }

  .target-panel,
  .level-panel {
    padding: 14px;
  }

  .dialog-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .primary-button,
  .secondary-button {
    width: 100%;
  }
}
