﻿:root {
  color-scheme: dark;
  --text: #f4f4f1;
  --muted: #7d818d;
  --shell-max-width: 760px;
  --shell-padding-x: 14px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

::selection {
  background: transparent;
  color: inherit;
}

::-moz-selection {
  background: transparent;
  color: inherit;
}

html,
body,
#app {
  width: 100%;
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  background: #211d30;
  color: var(--text);
  font-family: "Rubik Custom", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  user-select: none;
}

body.is-screen-transitioning #app {
  pointer-events: none;
}

body.transition-home-to-levels {
  --screen-leave-y: -18px;
  --screen-enter-y: 26px;
}

body.transition-home-to-daily {
  --screen-leave-y: -12px;
  --screen-enter-y: 22px;
}

body.transition-levels-to-home {
  --screen-leave-y: 18px;
  --screen-enter-y: -22px;
}

body.transition-daily-to-home {
  --screen-leave-y: 16px;
  --screen-enter-y: -18px;
}

body.transition-menu-to-game {
  --screen-leave-y: -8px;
  --screen-enter-y: 18px;
}

body.transition-game-to-menu {
  --screen-leave-y: 12px;
  --screen-enter-y: -18px;
}

button {
  font: inherit;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

body.is-home-menu,
body.is-level-menu,
body.is-daily-menu {
  overflow: auto;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.06), transparent 28%),
    #211d30;
  color: #f4f4f1;
}

body.is-home-menu {
  overflow: hidden;
}

body.is-daily-menu {
  overflow: hidden;
}

body.is-home-menu #app,
body.is-level-menu #app,
body.is-daily-menu #app {
  height: auto;
  min-height: 100%;
}

body.is-home-menu #app {
  height: 100dvh;
  min-height: 100dvh;
}

body.is-daily-menu #app {
  height: 100dvh;
  min-height: 100dvh;
}

.home-menu,
.level-menu {
  width: min(100%, var(--shell-max-width));
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) var(--shell-padding-x) max(24px, env(safe-area-inset-bottom));
  display: grid;
  gap: 18px;
  align-content: start;
}

.home-menu,
.level-menu,
.daily-menu,
.game-shell {
  transition:
    transform 240ms cubic-bezier(0.18, 0.92, 0.2, 1),
    opacity 180ms ease,
    filter 240ms ease;
  will-change: transform, opacity, filter;
}

.screen-leave {
  opacity: 0;
  filter: blur(8px);
  transform: translateY(var(--screen-leave-y, 18px)) scale(0.985);
}

.screen-enter {
  opacity: 0;
  filter: blur(10px);
  transform: translateY(var(--screen-enter-y, 20px)) scale(0.985);
}

.screen-enter.screen-enter-active {
  opacity: 1;
  filter: blur(0);
  transform: translateY(0) scale(1);
}

.home-menu {
  height: 100dvh;
  gap: 16px;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.level-menu {
  gap: 12px;
  align-content: start;
  padding-top: max(10px, env(safe-area-inset-top));
}

.daily-menu {
  width: min(100%, var(--shell-max-width));
  min-height: 100dvh;
  height: 100dvh;
  margin: 0 auto;
  padding: max(10px, env(safe-area-inset-top)) var(--shell-padding-x) max(24px, env(safe-area-inset-bottom));
  display: grid;
  gap: 12px;
  grid-template-rows: auto minmax(0, 1fr);
  align-content: start;
  overflow: hidden;
}

.home-menu > * {
  min-width: 0;
}

.home-panel {
  padding: 18px 18px 20px;
  display: grid;
  gap: 12px;
  color: #343642;
  background: linear-gradient(180deg, #f8f7f4 0%, #ece9e3 100%);
  border: 0;
  border-radius: clamp(24px, 4vw, 34px);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.95),
    0 14px 32px rgba(0, 0, 0, 0.18);
}

.home-panel-kicker {
  color: #7d818d;
  font-size: 12px;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.home-profile-panel {
  padding: 0 2px 4px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 12px;
}

.home-profile-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.home-main-actions {
  display: grid;
  align-content: start;
  gap: 16px;
  min-height: 0;
}

.home-progress-panel {
  display: grid;
  gap: 18px;
  justify-items: center;
  text-align: center;
  color: #343642;
}

.home-profile-avatar {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  font-size: 32px;
  color: #65489a;
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.9) 55%, rgba(221, 219, 226, 0.95) 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.95),
    0 6px 18px rgba(0, 0, 0, 0.16);
}

.home-profile-copy h1,
.home-play-copy h2 {
  margin: 0;
  font-size: clamp(34px, 9vw, 60px);
  line-height: 0.95;
  letter-spacing: -0.03em;
  color: #f7f5f2;
}

.home-profile-copy p,
.home-play-copy p,
.home-play-copy small {
  margin: 0;
  color: #6d727d;
  font-size: clamp(14px, 3.6vw, 16px);
  line-height: 1.35;
}

.home-profile-copy {
  min-width: 0;
  display: flex;
  align-items: center;
}

.home-profile-copy h1 {
  font-size: clamp(26px, 7vw, 42px);
}

.home-profile-stars {
  min-width: 0;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: transparent;
  box-shadow: none;
}

.home-profile-stars-icon {
  font-size: 32px;
  line-height: 1;
}

.home-profile-stars strong {
  color: #ffffff;
  font-size: clamp(28px, 6.4vw, 42px);
  line-height: 0.9;
}

.home-profile-settings {
  width: 68px;
  height: 68px;
  padding: 0;
  border: 0;
  border-radius: 22px;
  display: grid;
  place-items: center;
  color: #f7f5f2;
  background: linear-gradient(180deg, rgba(77, 79, 101, 0.96), rgba(54, 55, 74, 0.92));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    0 10px 24px rgba(0, 0, 0, 0.2);
}

.home-profile-settings-icon {
  font-size: 30px;
  line-height: 1;
}

.home-daily-panel {
  width: 100%;
  min-height: 0;
  height: 100%;
  align-content: start;
  grid-template-rows: minmax(0, 1fr) auto auto;
  gap: 14px;
  background: linear-gradient(180deg, rgba(77, 79, 101, 0.96), rgba(54, 55, 74, 0.92));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    0 14px 32px rgba(0, 0, 0, 0.22);
}

.home-daily-card {
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "copy stack"
    "button button";
  gap: 18px;
}

.home-daily-card-copy {
  grid-area: copy;
  display: grid;
  gap: 10px;
  align-content: start;
}

.home-daily-card-copy h2 {
  margin: 0;
  color: #343642;
  font-size: clamp(32px, 8vw, 56px);
  line-height: 0.95;
  letter-spacing: -0.03em;
}

.home-daily-card-copy small {
  margin: 0;
  color: #6d727d;
  font-size: clamp(14px, 3.6vw, 16px);
  line-height: 1.35;
}

.home-daily-card-stack {
  grid-area: stack;
  position: relative;
  width: 122px;
  height: 112px;
}

.home-daily-card-badge,
.home-daily-card-rank {
  position: absolute;
  display: grid;
  place-items: center;
  border-radius: 22px;
  box-shadow: 0 14px 24px rgba(0, 0, 0, 0.14);
}

.home-daily-card-badge {
  top: 0;
  right: 6px;
  width: 74px;
  height: 74px;
  color: rgba(255, 255, 255, 0.92);
  font-size: 30px;
  font-weight: 700;
  background: linear-gradient(180deg, #ffd79a 0%, #f0ad43 100%);
  transform: rotate(15deg);
}

.home-daily-card-rank {
  left: 4px;
  bottom: 6px;
  width: 72px;
  height: 72px;
  color: rgba(52, 54, 66, 0.7);
  font-size: 22px;
  font-weight: 700;
  background: linear-gradient(180deg, #f1e7ff 0%, #d8bff6 100%);
  transform: rotate(-14deg);
}

.home-daily-card-button {
  grid-area: button;
  width: 100%;
  min-height: 96px;
  padding: 0 28px;
  border: 0;
  border-radius: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: #23243a;
  font-size: clamp(24px, 6vw, 42px);
  font-weight: 600;
  background: linear-gradient(180deg, #ffd68c 0%, #f7bf59 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 247, 224, 0.96),
    inset 0 -5px 0 rgba(162, 98, 22, 0.12),
    0 12px 22px rgba(201, 132, 29, 0.18);
}

.daily-screen-panel {
  min-height: 0;
  height: 100%;
  margin-top: 4px;
}

.home-daily-copy strong,
.home-daily-reward strong,
.home-daily-tab strong,
.home-daily-play-copy strong {
  font-size: clamp(24px, 6.5vw, 38px);
  line-height: 1;
  color: #343642;
}

.home-daily-copy small,
.home-daily-reward span,
.home-daily-tab small,
.home-daily-play-copy small {
  color: #7d818d;
  font-size: clamp(13px, 3.2vw, 15px);
}

.home-daily-board {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 0;
  align-content: start;
  gap: 0;
  padding: 0;
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(251, 249, 244, 0.92));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 4px 12px rgba(0, 0, 0, 0.04);
  overflow: hidden;
}

.home-daily-board-list {
  display: grid;
  align-content: start;
  gap: 0;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.home-daily-board-list::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.home-daily-board-row,
.home-daily-player-row {
  display: grid;
  grid-template-columns: 44px 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 12px 16px;
  border-radius: 0;
}

.home-daily-board-row {
  background: transparent;
  border-bottom: 1px solid rgba(73, 75, 94, 0.08);
}

.home-daily-board-row.is-top {
  background: linear-gradient(180deg, rgba(255, 198, 96, 0.1), rgba(255, 255, 255, 0));
}

.home-daily-player-wrap {
  padding: 18px 10px 10px;
  background: linear-gradient(180deg, rgba(251, 249, 244, 0) 0%, rgba(251, 249, 244, 0.86) 42%, rgba(251, 249, 244, 0.98) 100%);
}

.home-daily-player-row {
  margin-top: 0;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 247, 228, 0.88), rgba(255, 255, 255, 0.96));
  box-shadow:
    inset 0 0 0 1px rgba(241, 179, 68, 0.45),
    0 8px 18px rgba(239, 184, 74, 0.14);
}

.home-daily-board-medal {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.4);
}

.home-daily-board-medal.medal-1 {
  background: linear-gradient(180deg, #ffd46e 0%, #f0a72f 100%);
}

.home-daily-board-medal.medal-2 {
  background: linear-gradient(180deg, #d8dbe4 0%, #a8aebb 100%);
}

.home-daily-board-medal.medal-3 {
  background: linear-gradient(180deg, #efbe90 0%, #c67d42 100%);
}

.home-daily-board-avatar {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  font-size: 21px;
  background: linear-gradient(180deg, #f1f4f8 0%, #d5deeb 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.home-daily-board-avatar.is-player {
  color: #6f49a4;
  background: linear-gradient(180deg, #f4efff 0%, #dfd0ff 100%);
}

.home-daily-board-place,
.home-daily-board-score {
  font-size: 15px;
  line-height: 1;
}

.home-daily-board-place {
  width: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #565b67;
  font-weight: 700;
  text-align: center;
}

.home-daily-board-place.is-player-place {
  color: #7d818d;
}

.home-daily-board-name {
  min-width: 0;
  font-size: 17px;
  font-weight: 600;
  color: #343642;
}

.home-daily-board-score {
  color: #343642;
}

.home-daily-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.home-daily-tab {
  min-height: 120px;
  padding: 18px 18px 20px;
  border: 0;
  border-radius: 24px;
  display: grid;
  align-content: space-between;
  gap: 12px;
  justify-items: start;
  text-align: left;
  color: #343642;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(247, 245, 241, 0.92));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.96),
    0 10px 20px rgba(0, 0, 0, 0.08);
}

.home-daily-tab.active {
  background: linear-gradient(180deg, rgba(255, 247, 230, 0.98), rgba(255, 244, 226, 0.96));
  box-shadow:
    inset 0 0 0 2px rgba(246, 175, 51, 0.72),
    0 12px 22px rgba(236, 179, 70, 0.14);
}

.home-daily-tab:not(.active) {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.94),
    0 10px 18px rgba(0, 0, 0, 0.07);
}

.home-daily-tab-kicker {
  font-size: clamp(17px, 4vw, 22px);
  line-height: 1.15;
  color: #343642;
  font-weight: 600;
}

.home-daily-tab-reward {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.98),
    0 4px 10px rgba(0, 0, 0, 0.06);
}

.home-daily-tab-star {
  color: #ffb13a;
  font-size: 18px;
  line-height: 1;
}

.home-daily-tab-reward small {
  color: #5d6472;
  font-size: 16px;
  line-height: 1;
  font-weight: 700;
}

.home-daily-play,
.home-play-button {
  width: 100%;
  min-height: 96px;
  padding: 0 28px;
  border: 0;
  border-radius: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: #23243a;
  font-size: clamp(24px, 6vw, 42px);
  font-weight: 600;
  background: linear-gradient(180deg, #ffd68c 0%, #f7bf59 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 247, 224, 0.96),
    inset 0 -5px 0 rgba(162, 98, 22, 0.12),
    0 12px 22px rgba(201, 132, 29, 0.18);
}

.home-daily-play {
  margin-top: auto;
  text-align: center;
}

.home-daily-play-copy {
  display: grid;
  gap: 0;
}

.home-daily-play-copy strong {
  font-size: inherit;
  font-weight: inherit;
}

.home-daily-play-icon,
.home-play-icon {
  font-size: 0.72em;
  line-height: 1;
  flex: 0 0 auto;
}

.home-play-copy {
  display: grid;
  gap: 10px;
  align-content: start;
}

.home-play-panel {
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "copy stack"
    "button button";
  gap: 18px;
}

.home-play-copy {
  grid-area: copy;
}

.home-play-copy h2 {
  color: #343642;
}

.home-play-progress {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: rgba(73, 75, 94, 0.08);
  overflow: hidden;
}

.home-play-progress-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #f0ac35 0%, #ffd37a 100%);
}

.home-play-stack {
  grid-area: stack;
  position: relative;
  width: 144px;
  height: 118px;
}

.home-play-stack-tile {
  position: absolute;
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  font-size: 28px;
  font-weight: 700;
  color: rgba(52, 54, 66, 0.45);
  box-shadow: 0 14px 24px rgba(0, 0, 0, 0.14);
}

.stack-a {
  top: 0;
  right: 14px;
  background: linear-gradient(180deg, #fffdf9 0%, #ece6dc 100%);
  transform: rotate(18deg);
}

.stack-b {
  top: 34px;
  left: 14px;
  background: linear-gradient(180deg, #dff4e8 0%, #9ed1c2 100%);
  transform: rotate(-20deg);
}

.stack-c {
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg, #ffd79a 0%, #f0ad43 100%);
  color: rgba(255, 255, 255, 0.84);
  transform: rotate(16deg);
}

.home-play-button {
  grid-area: button;
  gap: 18px;
  color: #f7f4ff;
  background: linear-gradient(180deg, #b57cff 0%, #8f5ae8 52%, #7443cf 100%);
  box-shadow:
    inset 0 2px 0 rgba(240, 226, 255, 0.92),
    inset 0 -5px 0 rgba(80, 43, 144, 0.34),
    0 12px 24px rgba(104, 58, 185, 0.32);
}

body.is-home-compact .home-menu {
  gap: 12px;
}

body.is-home-compact .home-panel {
  padding: 16px 16px 18px;
}

body.is-home-compact .home-profile-avatar {
  width: 64px;
  height: 64px;
  font-size: 28px;
}

body.is-home-compact .home-profile-stars {
  gap: 8px;
}

body.is-home-compact .home-profile-copy h1,
body.is-home-compact .home-play-copy h2 {
  font-size: clamp(28px, 8vw, 46px);
}

body.is-home-compact .home-daily-tab {
  min-height: 100px;
  padding: 14px 14px 16px;
}

body.is-home-compact .home-daily-tab-kicker {
  font-size: clamp(15px, 3.8vw, 18px);
}

body.is-home-compact .home-daily-tab-reward small {
  font-size: 14px;
}

body.is-home-compact .home-daily-play,
body.is-home-compact .home-play-button {
  min-height: 82px;
  font-size: clamp(21px, 5.4vw, 32px);
}

body.is-home-compact .home-profile-settings {
  width: 58px;
  height: 58px;
  border-radius: 18px;
}

body.is-home-compact .home-play-panel {
  gap: 14px;
}

body.is-home-compact .home-daily-card {
  gap: 14px;
}

body.is-home-compact .home-play-stack {
  width: 118px;
  height: 86px;
}

body.is-home-compact .home-daily-card-stack {
  width: 108px;
  height: 92px;
}

body.is-home-compact .home-play-stack-tile {
  width: 54px;
  height: 54px;
  font-size: 22px;
}

body.is-home-compact .home-daily-card-badge {
  width: 62px;
  height: 62px;
  font-size: 24px;
}

body.is-home-compact .home-daily-card-rank {
  width: 60px;
  height: 60px;
  font-size: 18px;
}

body.is-home-tight .home-menu {
  gap: 10px;
}

body.is-home-tight .home-profile-panel {
  column-gap: 10px;
}

body.is-home-tight .home-profile-avatar {
  width: 56px;
  height: 56px;
  font-size: 24px;
}

body.is-home-tight .home-profile-stars {
  gap: 8px;
}

body.is-home-tight .home-daily-board-row,
body.is-home-tight .home-daily-player-row {
  padding: 8px 10px;
  gap: 8px;
}

body.is-home-tight .home-daily-board-avatar,
body.is-home-tight .home-daily-board-medal {
  width: 32px;
  height: 32px;
  font-size: 18px;
}

body.is-home-tight .home-daily-board-row,
body.is-home-tight .home-daily-player-row {
  grid-template-columns: 32px 32px minmax(0, 1fr) auto;
}

body.is-home-tight .home-daily-board-place {
  width: 32px;
}

body.is-home-tight .home-daily-board-place,
body.is-home-tight .home-daily-board-score,
body.is-home-tight .home-daily-board-name {
  font-size: 13px;
}

body.is-home-tight .home-daily-player-wrap {
  padding: 14px 8px 8px;
}

body.is-home-tight .home-daily-tab {
  padding: 12px 10px 14px;
  min-height: 0;
}

body.is-home-tight .home-daily-tab-kicker {
  font-size: 14px;
  line-height: 1.08;
}

body.is-home-tight .home-daily-tab-reward {
  padding: 6px 10px;
}

body.is-home-tight .home-daily-play,
body.is-home-tight .home-play-button {
  min-height: 72px;
  padding: 0 18px;
  font-size: clamp(18px, 5vw, 26px);
}

body.is-home-tight .home-play-panel {
  grid-template-columns: 1fr;
  grid-template-areas:
    "copy"
    "button";
}

body.is-home-tight .home-daily-card {
  grid-template-columns: 1fr;
  grid-template-areas:
    "copy"
    "button";
}

body.is-home-tight .home-play-stack {
  display: none;
}

body.is-home-tight .home-daily-card-stack {
  display: none;
}

body.is-home-tight .home-profile-settings {
  width: 50px;
  height: 50px;
  border-radius: 16px;
}

body.is-home-tight .home-profile-settings-icon {
  font-size: 24px;
}

@media (max-height: 820px) {
  .home-menu {
    padding-top: max(14px, env(safe-area-inset-top));
    padding-bottom: max(18px, env(safe-area-inset-bottom));
    gap: 14px;
  }

  .home-panel {
    padding: 16px 16px 18px;
  }

  .home-profile-avatar {
    width: 84px;
    height: 84px;
    font-size: 38px;
  }

  .home-main-actions {
    gap: 14px;
  }

  .home-daily-panel {
    min-height: 0;
  }

  .home-profile-copy h1,
  .home-play-copy h2 {
    font-size: clamp(28px, 8vw, 46px);
  }

  .home-tile {
    min-height: 130px;
    padding: 16px 14px;
  }

  .home-tile-icon {
    width: 62px;
    height: 62px;
    border-radius: 20px;
    font-size: 26px;
  }

  .home-daily-play-copy strong {
    font-size: clamp(22px, 5.8vw, 30px);
  }
}

@media (max-width: 520px) {
  .home-menu {
    gap: 12px;
    padding-left: 10px;
    padding-right: 10px;
  }

  .home-panel {
    padding: 14px 14px 16px;
  }

  .home-profile-panel {
    grid-template-columns: 64px minmax(0, 1fr) auto;
    align-items: start;
    column-gap: 10px;
  }

  .home-profile-avatar {
    width: 64px;
    height: 64px;
    font-size: 28px;
  }

  .home-profile-stars {
    justify-self: end;
    align-self: start;
    min-width: 0;
    padding: 0;
    gap: 10px;
  }

  .home-profile-stars-icon {
    font-size: 24px;
  }

  .home-profile-stars strong {
    font-size: clamp(22px, 5.8vw, 32px);
  }

  .home-profile-actions {
    gap: 8px;
  }

  .home-profile-settings {
    width: 64px;
    height: 64px;
    border-radius: 20px;
  }

  .home-profile-settings-icon {
    font-size: 30px;
  }

  .home-profile-copy {
    gap: 4px;
  }

  .home-profile-copy h1 {
    font-size: clamp(26px, 8vw, 44px);
  }

  .home-play-copy p,
  .home-play-copy small {
    font-size: 12px;
  }

  .home-daily-board-row,
  .home-daily-player-row {
    gap: 10px;
    padding: 10px 12px;
  }

  .home-daily-board-avatar,
  .home-daily-board-medal {
    width: 36px;
    height: 36px;
    font-size: 20px;
  }

  .home-daily-board-row,
  .home-daily-player-row {
    grid-template-columns: 36px 36px minmax(0, 1fr) auto;
  }

  .home-daily-board-place {
    width: 36px;
  }

  .home-daily-board-name {
    font-size: 16px;
  }

  .home-daily-board-place,
  .home-daily-board-score,
  .home-daily-board-name {
    font-size: 14px;
  }

  .home-daily-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
  }

  .home-daily-tab {
    padding: 10px 8px 12px;
    min-height: 0;
  }

  .home-daily-tab-kicker {
    font-size: 13px;
    line-height: 1.05;
  }

  .home-daily-tab-reward {
    padding: 6px 10px;
  }

  .home-daily-tab-reward small {
    font-size: 13px;
  }

  .home-daily-play {
    min-height: 74px;
    padding: 0 16px;
  }

  .home-daily-play-copy strong {
    font-size: clamp(18px, 6.2vw, 24px);
  }

  .home-daily-play-icon,
  .home-play-icon {
    font-size: 0.72em;
  }

  .home-play-panel {
    position: relative;
    grid-template-columns: 1fr;
    grid-template-areas:
      "copy"
      "button";
    gap: 12px;
  }

  .home-play-copy {
    padding-right: 104px;
  }

  .home-play-stack {
    position: absolute;
    right: 14px;
    bottom: 92px;
    width: 92px;
    height: 74px;
    justify-self: auto;
  }

  .home-play-stack-tile {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    font-size: 18px;
  }

  .stack-a {
    right: 8px;
  }

  .stack-b {
    top: 22px;
    left: 8px;
  }

  .home-play-button {
    min-height: 78px;
    font-size: clamp(18px, 6vw, 24px);
  }

  .home-daily-card {
    position: relative;
    grid-template-columns: 1fr;
    grid-template-areas:
      "copy"
      "button";
    gap: 12px;
  }

  .home-daily-card-copy {
    padding-right: 98px;
  }

  .home-daily-card-copy h2 {
    font-size: clamp(28px, 8vw, 40px);
  }

  .home-daily-card-stack {
    position: absolute;
    right: 14px;
    bottom: 88px;
    width: 84px;
    height: 72px;
  }

  .home-daily-card-badge {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    font-size: 18px;
  }

  .home-daily-card-rank {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    font-size: 14px;
  }

  .home-daily-card-button {
    min-height: 78px;
    font-size: clamp(18px, 6vw, 24px);
  }
}

.debug-toggle {
  min-height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: 14px;
  background: rgba(52, 54, 66, 0.08);
  color: #505461;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    inset 0 -3px 0 rgba(0, 0, 0, 0.08);
}

.debug-toggle.active {
  background: #f2b867;
  color: #2b2418;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    inset 0 -3px 0 rgba(0, 0, 0, 0.12);
}

.debug-toggle:active {
  transform: translateY(1px);
}

.level-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(8px, 2.4vw, 12px);
}

.level-card {
  position: relative;
  min-width: 0;
  aspect-ratio: 1 / 1;
  padding: 10px 8px 12px;
  border: 0;
  border-radius: clamp(10px, 2.2vw, 14px);
  color: rgba(12, 13, 16, 0.86);
  background: var(--tile, #86beb3);
  cursor: pointer;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 6px;
  place-items: center;
  align-content: center;
  box-shadow:
    inset 0 -5px 0 var(--tile-side, rgba(0, 0, 0, 0.12)),
    0 8px 0 rgba(0, 0, 0, 0.28),
    0 13px 20px rgba(0, 0, 0, 0.16);
}

.level-card.theme-reach,
.level-card.theme-classic {
  --tile: #86beb3;
  --tile-side: #5d8982;
}

.level-card.theme-collection {
  --tile: #efeec0;
  --tile-side: #b6b48a;
}

.level-card.theme-score {
  --tile: #f2b867;
  --tile-side: #b9823d;
}

.level-card.theme-puzzle {
  --tile: #f45b5f;
  --tile-side: #b43940;
}

.level-card-number {
  font-size: clamp(22px, 6vw, 34px);
  line-height: 1;
}

.level-card-goal {
  min-height: 34px;
  display: grid;
  place-items: center;
  width: 100%;
}

.level-card-goal-number,
.level-card-goal-text {
  color: inherit;
  font-size: clamp(14px, 3.8vw, 18px);
  font-weight: 700;
  line-height: 1;
}

.level-card-goal-number {
  letter-spacing: -0.03em;
}

.level-card-goal-text {
  font-size: clamp(12px, 3.2vw, 15px);
  text-transform: lowercase;
}

.level-card-stars {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.level-card-star {
  color: rgba(18, 22, 28, 0.22);
  font-size: clamp(15px, 4vw, 19px);
  line-height: 1;
}

.level-card-star.is-earned {
  color: #fff4b4;
  text-shadow:
    0 1px 0 rgba(129, 95, 25, 0.24),
    0 0 10px rgba(255, 239, 158, 0.28);
}

.level-card-footer {
  color: rgba(12, 13, 16, 0.62);
  font-size: clamp(10px, 2.7vw, 12px);
  line-height: 1;
}

.level-card-footer {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.level-card.locked {
  background: #4e5160;
  color: rgba(255, 255, 255, 0.9);
  box-shadow:
    inset 0 -4px 0 rgba(0, 0, 0, 0.18),
    0 8px 0 rgba(0, 0, 0, 0.22),
    0 13px 20px rgba(0, 0, 0, 0.14);
  cursor: default;
  opacity: 0.78;
}

.level-card.locked .level-card-footer,
.level-card.locked .level-card-star {
  color: rgba(255, 255, 255, 0.72);
}

.level-card.completed {
  box-shadow:
    inset 0 -4px 0 rgba(0, 0, 0, 0.1),
    inset 0 0 0 3px rgba(255, 255, 255, 0.38),
    0 8px 0 rgba(0, 0, 0, 0.28),
    0 13px 20px rgba(0, 0, 0, 0.16);
}

.level-card:active {
  transform: translateY(2px);
  box-shadow:
    inset 0 -2px 0 rgba(0, 0, 0, 0.1),
    0 5px 0 rgba(0, 0, 0, 0.28),
    0 9px 16px rgba(0, 0, 0, 0.16);
}

.level-menu-strip.level-strip,
.daily-menu-strip.level-strip {
  position: sticky;
  top: max(10px, env(safe-area-inset-top));
  z-index: 12;
}

.daily-menu-strip.level-strip {
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.9),
    inset 0 -7px 0 rgba(0, 0, 0, 0.16);
}

.level-menu-season {
  margin: 0;
}

.daily-menu-title {
  margin: 0;
}

.level-menu-progress {
  text-transform: lowercase;
  white-space: nowrap;
}

.level-menu-tools {
  display: flex;
  justify-content: flex-end;
  margin-top: -4px;
}

body.is-game-screen {
  --board-recess: #171423;
  --muted: #7d818d;
  --cell-gap: 2px;
  --select-press-ms: 160ms;
  --select-press-ease: cubic-bezier(0.18, 0.92, 0.2, 1);
  --game-sticky-top: max(10px, env(safe-area-inset-top));
  --game-strip-height: 74px;
  --game-hud-height: 66px;
  --game-shell-padding-y: max(10px, env(safe-area-inset-top));
  --game-shell-padding-bottom: max(18px, env(safe-area-inset-bottom));
  --game-chrome-height: calc(var(--game-strip-height) + var(--game-hud-height) + 20px);
  --game-board-max-width: calc(var(--shell-max-width) - (var(--shell-padding-x) * 2));
  --board-size: min(
    calc(100vw - (var(--shell-padding-x) * 2)),
    var(--game-board-max-width),
    calc(100dvh - var(--game-chrome-height) - var(--game-shell-padding-y) - var(--game-shell-padding-bottom) - 28px)
  );
  overflow: auto;
  background: #211d30;
}

body.is-game-screen::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.45;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(255, 255, 255, 0.035), transparent 42%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 38%);
}

.game-shell {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  width: min(100%, var(--shell-max-width));
  margin: 0 auto;
  padding:
    var(--game-shell-padding-y)
    var(--shell-padding-x)
    var(--game-shell-padding-bottom);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
}

.game-top-slot {
  display: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.level-strip {
  width: 100%;
  min-height: 58px;
  margin: 0 auto;
  padding: 8px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  color: #343642;
  background: linear-gradient(180deg, #f4f4f1 0%, #e7e7e3 100%);
  border-radius: clamp(20px, 4vw, 30px);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.9),
    inset 0 -7px 0 rgba(0, 0, 0, 0.16),
    0 12px 0 rgba(0, 0, 0, 0.22);
}

body.is-game-screen .level-strip {
  position: sticky;
  top: var(--game-sticky-top);
  z-index: 16;
}

.level-strip-left {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  justify-self: start;
}

.menu-icon-button {
  width: 42px;
  height: 42px;
  aspect-ratio: 1 / 1;
  flex: 0 0 auto;
  align-self: center;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(180deg, #eef3f7, #cfd8e3);
  color: #556273;
  font-size: 34px;
  line-height: 0.8;
  cursor: pointer;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.88),
    inset 0 -2px 0 rgba(63, 82, 102, 0.14);
  transform: translateY(-3px);
}

.level-strip-copy {
  min-width: 0;
  display: flex;
  align-items: center;
}

.level-strip-copy strong {
  font-size: clamp(11px, 3vw, 13px);
  line-height: 1.2;
  color: #6d727d;
  font-weight: 500;
}

.level-strip-goal,
.level-strip-meta {
  color: #6d727d;
  font-size: clamp(11px, 3vw, 13px);
  line-height: 1.2;
}

.level-strip-goal {
  min-width: 0;
  justify-self: center;
  max-width: min(100%, 320px);
  padding: 0 8px;
  color: #343642;
  font-size: clamp(18px, 4.8vw, 26px);
  font-weight: 700;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.goal-tile-row {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  vertical-align: middle;
}

.goal-prefix,
.goal-suffix {
  font-size: 0.56em;
  font-weight: 600;
  color: #7a7d86;
}

.goal-value {
  color: inherit;
}

.goal-score-live {
  display: inline-block;
  transform-origin: 50% 50%;
  transform: scale(1);
  transition: transform 120ms linear;
}

.goal-score-live.score-gain {
  transform: scale(var(--score-gain-scale, 1));
}

.goal-tile {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 1.45em;
  height: 1.45em;
  vertical-align: middle;
  border-radius: 0.34em;
  color: var(--tile-text, #211d30);
  background: var(--tile-side, rgba(0, 0, 0, 0.28));
}

.goal-tile::before {
  content: "";
  position: absolute;
  inset: 0 0 0.2em;
  border-radius: inherit;
  background: var(--tile, #86beb3);
}

.goal-tile-label {
  position: relative;
  z-index: 1;
  transform: translateY(-0.08em);
  font-size: 0.62em;
  font-weight: 800;
  line-height: 1;
}

.goal-tile-top {
  margin-left: 0.18em;
  width: 45px;
  height: 45px;
  border-radius: 13px;
}

.goal-tile-top::before {
  inset: 0 0 6px;
}

.goal-tile-top .goal-tile-label {
  transform: translateY(-2px);
  font-size: 0.7em;
}

.level-strip-meta {
  min-width: 72px;
  max-width: 120px;
  text-align: right;
}

.level-strip-meta:empty {
  min-width: 0;
}

.level-strip-meta.level-strip-meta-emphasis {
  color: #4e5563;
  font-size: clamp(14px, 3.8vw, 18px);
  font-weight: 700;
  line-height: 1;
}

.level-strip-side {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  justify-self: end;
}

.game-over {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
  pointer-events: none;
  opacity: 0;
  background: rgba(13, 11, 21, 0.38);
  transition: opacity 180ms ease;
}

.game-over.visible {
  opacity: 1;
  pointer-events: auto;
}

.game-over-card {
  min-width: min(78vw, 320px);
  padding: 22px 28px 26px;
  display: grid;
  gap: 8px;
  place-items: center;
  color: #333642;
  background: linear-gradient(180deg, #f4f4f1 0%, #e7e7e3 100%);
  border-radius: clamp(22px, 4vw, 34px);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.9),
    inset 0 -7px 0 rgba(0, 0, 0, 0.16),
    0 12px 0 rgba(0, 0, 0, 0.26),
    0 22px 42px rgba(0, 0, 0, 0.28);
  transform: translateY(8px) scale(0.96);
  transition: transform 180ms cubic-bezier(0.16, 0.9, 0.2, 1);
}

.game-over.visible .game-over-card {
  transform: translateY(0) scale(1);
}

.game-over-card strong {
  font-size: clamp(30px, 8vw, 48px);
  line-height: 1;
}

.game-over-card span {
  color: #6d727d;
  font-size: clamp(14px, 3.8vw, 17px);
}

.game-over-score {
  margin-top: 4px;
  color: #5e6470;
  font-size: clamp(16px, 4vw, 20px);
}

.game-over-score strong {
  font-size: inherit;
}

.game-over-actions {
  margin-top: 10px;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.game-over-actions.single {
  grid-template-columns: minmax(0, 1fr);
}

.game-over-button {
  min-height: 46px;
  border: 0;
  border-radius: 16px;
  background: #dcdcd7;
  color: #444755;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.85),
    inset 0 -5px 0 rgba(0, 0, 0, 0.12),
    0 6px 0 rgba(0, 0, 0, 0.18);
}

.game-over-button.primary {
  background: #f2b867;
  color: #2b2418;
}

.game-over-button:active {
  transform: translateY(1px);
}

.hud {
  width: 100%;
  margin: 0 auto;
  background: linear-gradient(180deg, #f4f4f1 0%, #e7e7e3 100%);
  border: 0;
  border-radius: clamp(22px, 4vw, 34px);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.9),
    inset 0 -7px 0 rgba(0, 0, 0, 0.16),
    0 12px 0 rgba(0, 0, 0, 0.22);
}

.hud {
  min-height: 66px;
  padding: 0;
  overflow: hidden;
}

body.is-game-screen .hud {
  position: sticky;
  top: calc(var(--game-sticky-top) + var(--game-strip-height) + 10px);
  z-index: 15;
}

.hud strong {
  font-size: clamp(22px, 6vw, 32px);
  line-height: 1;
  letter-spacing: 0;
  color: #333642;
  display: inline-block;
  transform-origin: 50% 50%;
  transform: scale(1);
  transition: transform 120ms linear;
}

.hud strong.score-gain {
  transform: scale(var(--score-gain-scale, 1));
}

.hud-timer {
  position: relative;
  min-height: 66px;
  width: 100%;
  overflow: hidden;
}

.hud-timer.no-timer .hud-timer-track,
.hud-timer.no-timer .hud-timer-text {
  opacity: 0;
}

.hud-timer-track {
  position: absolute;
  inset: 1px 2px 8px;
  overflow: hidden;
  border-radius: calc(clamp(22px, 4vw, 34px) - 1px);
}

.hud-timer-base {
  position: absolute;
  inset: 0;
  background: #ecece7;
}

.hud-timer-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 100%;
  border-radius: inherit;
  background:
    linear-gradient(90deg, #f2b867 0%, #f08a4b 55%, #df5757 100%);
  box-shadow:
    0 0 14px rgba(240, 138, 75, 0.26);
  transition: width 120ms linear, filter 120ms linear;
}

.hud-timer-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0.06) 36%, rgba(255, 255, 255, 0) 54%);
}

.hud-timer.is-low .hud-timer-fill {
  filter: saturate(1.12) brightness(0.98);
}

.hud-timer.is-critical .hud-timer-fill {
  filter: saturate(1.24) brightness(0.95);
}

.hud-timer-text {
  position: absolute;
  top: 50%;
  left: 18px;
  z-index: 1;
  color: #5f5f63;
  font-size: clamp(12px, 3vw, 14px);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  transform: translateY(-50%);
}

.hud-score {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.hud-score.hidden {
  opacity: 0;
}

.hud-collection-goals {
  position: absolute;
  inset: 0 20px;
  z-index: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 34px;
  pointer-events: none;
}

.hud-collection-slot {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #333642;
  font-weight: 700;
}

.goal-tile-hud {
  width: 45px;
  height: 45px;
  border-radius: 13px;
  font-size: 29px;
}

.goal-tile-hud::before {
  inset: 0 0 6px;
}

.goal-tile-hud .goal-tile-label {
  transform: translateY(-2px);
  font-size: 0.7em;
}

.hud-collection-count {
  min-width: 1ch;
  font-size: clamp(18px, 4.8vw, 28px);
  line-height: 1;
  display: inline-block;
  transform-origin: 50% 50%;
  transform: scale(1);
  transition: transform 120ms linear;
}

.hud-collection-count.score-gain {
  transform: scale(var(--score-gain-scale, 1));
}

.icon-button {
  width: 44px;
  height: 44px;
  aspect-ratio: 1 / 1;
  flex: 0 0 auto;
  align-self: center;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(180deg, #f8e6bf, #e8bd6b);
  color: #6a4b18;
  font-size: 28px;
  line-height: 0.8;
  cursor: pointer;
  box-shadow:
    inset 0 2px 0 rgba(255, 247, 224, 0.9),
    inset 0 -2px 0 rgba(129, 89, 23, 0.14);
  transform: translateY(-3px);
  padding-top: 2px;
}

.icon-button {
  text-indent: -2px;
}

.icon-button:active {
  transform: translateY(-2px);
}

.board-wrap {
  grid-row: 3;
  align-self: center;
  justify-self: center;
  width: var(--board-size);
  height: var(--board-size);
  margin: 0 auto;
  display: grid;
  place-items: center;
}

.board {
  position: relative;
  width: 100%;
  height: 100%;
  padding: var(--cell-gap);
  border-radius: clamp(16px, 3vw, 26px);
  background: var(--board-recess);
  border: 0;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  box-shadow:
    inset 0 22px 28px rgba(0, 0, 0, 0.34),
    inset 0 2px 0 rgba(0, 0, 0, 0.32),
    0 16px 28px rgba(0, 0, 0, 0.12);
}

.cell {
  z-index: 1;
  position: absolute;
  border: 0;
  border-radius: var(--cell-radius, 20px);
  overflow: visible;
  color: var(--tile-text, #211d30);
  background: transparent;
  display: grid;
  place-items: center;
  font-size: var(--cell-font-size, 36px);
  font-weight: 760;
  line-height: 1;
  letter-spacing: 0;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  outline: none;
  transform: scale(1);
  transition:
    transform 180ms cubic-bezier(0.16, 0.9, 0.2, 1),
    filter 160ms ease,
    opacity 160ms ease;
  box-shadow: none;
}

.blocker {
  position: absolute;
  z-index: 0;
  border-radius: var(--cell-radius, 20px);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 42%),
    #0f0d17;
  box-shadow:
    inset 0 8px 12px rgba(0, 0, 0, 0.38),
    inset 0 -2px 0 rgba(255, 255, 255, 0.04);
}

.blocker::after {
  content: "";
  position: absolute;
  inset: 20%;
  border-radius: inherit;
  background: rgba(255, 255, 255, 0.035);
}

.cell::before {
  content: "";
  position: absolute;
  inset: 0 0 var(--cell-depth, 9px);
  z-index: 1;
  border-radius: inherit;
  background: var(--tile, #86beb3);
  pointer-events: none;
  transform: translateY(0);
  filter: brightness(1);
  overflow: hidden;
  transition:
    transform var(--select-press-ms, 160ms) var(--select-press-ease, cubic-bezier(0.18, 0.92, 0.2, 1)),
    filter var(--select-press-ms, 160ms) ease;
}

.cell-label {
  position: relative;
  z-index: 2;
  transform: translateY(-4px);
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  transition: transform var(--select-press-ms, 160ms) var(--select-press-ease, cubic-bezier(0.18, 0.92, 0.2, 1));
}

.cell::after {
  content: "";
  position: absolute;
  inset: var(--cell-back-offset, 8px) 0 0;
  z-index: 0;
  border-radius: inherit;
  background: var(--tile-side, rgba(0, 0, 0, 0.28));
  pointer-events: none;
}

.cell.selected::before {
  transform: translateY(var(--cell-press-y, 6px));
  filter: brightness(0.98);
}

.cell.selected .cell-label {
  transform: translateY(var(--cell-label-press-y, 2px));
}

.selection-edge {
  position: absolute;
  z-index: 6;
  pointer-events: none;
  border-radius: 999px;
  background: #ffffff;
  box-shadow:
    0 0 4px rgba(255, 255, 255, 0.26),
    0 0 8px rgba(255, 255, 255, 0.1);
}

.selection-particle {
  position: absolute;
  z-index: 5;
  width: 5px;
  height: 5px;
  border-radius: 999px;
  pointer-events: none;
  background: rgba(255, 252, 230, 0.94);
  box-shadow:
    0 0 8px rgba(255, 252, 230, 0.62),
    0 0 14px rgba(255, 255, 255, 0.32);
  transform: translate(-50%, -50%);
  animation: selectionParticle 980ms ease-in-out var(--particle-delay, 0ms) infinite;
}

.cell.invalid {
  animation: shake 220ms ease;
}

.cell.spawn {
  animation: pop 240ms ease;
}

.cell.merge-flyover {
  z-index: 3;
  pointer-events: none;
  transition: transform var(--fly-duration, 240ms) cubic-bezier(0.12, 0.82, 0.2, 1);
  box-shadow: none;
}

.cell.merge-flyover::before {
  transform: translateY(6px);
  filter: brightness(0.98);
}

.cell.merge-flyover .cell-label {
  transform: translateY(2px);
}

.cell.merge-anchor {
  z-index: 8;
}

.merge-score-popup {
  position: fixed;
  z-index: 20;
  pointer-events: none;
  color: rgba(255, 255, 255, 0.98);
  font-size: calc(var(--cell-font-size, 36px) * 2);
  font-weight: 760;
  line-height: 1;
  white-space: nowrap;
  text-shadow:
    0 2px 0 rgba(0, 0, 0, 0.22),
    0 6px 14px rgba(0, 0, 0, 0.28);
  transform: translate(-50%, -50%);
  transform-origin: 50% 100%;
  animation: mergeScoreFloat var(--merge-score-duration, 720ms) cubic-bezier(0.16, 0.9, 0.2, 1) both;
}

.cell.dropping,
.cell.merged-pulse {
  pointer-events: none;
}

.cell.merged-pulse {
  animation: mergeGlow 420ms ease-out both;
}

.cell.merged-pulse::before {
  animation: mergeFlashTop 420ms ease-out both;
}

.value-1 { --tile: #86beb3; --tile-side: #5d8982; }
.value-2 { --tile: #efeec0; --tile-side: #b6b48a; }
.value-3 { --tile: #f2b867; --tile-side: #b9823d; }
.value-4 { --tile: #f45b5f; --tile-side: #b43940; }
.value-5 { --tile: #604d55; --tile-side: #3f3238; --tile-text: rgba(255, 250, 236, 0.92); }
.value-6 { --tile: #4ea6b8; --tile-side: #347587; --tile-text: rgba(255, 250, 236, 0.96); }
.value-7 { --tile: #a85f9b; --tile-side: #76426d; --tile-text: rgba(255, 250, 236, 0.96); }
.value-8 { --tile: #b0bd7b; --tile-side: #7f8b52; --tile-text: rgba(255, 250, 236, 0.96); }
.value-9 { --tile: #d08a3f; --tile-side: #9a622d; --tile-text: rgba(255, 250, 236, 0.96); }
.value-10 { --tile: #88b6cc; --tile-side: #5f8699; --tile-text: #211d30; }

@keyframes pop {
  from {
    opacity: 0;
    transform: scale(0.66);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes shake {
  25% { transform: translateX(-4px); }
  50% { transform: translateX(4px); }
  75% { transform: translateX(-2px); }
}

@keyframes selectionParticle {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.45);
  }
  22% {
    opacity: 1;
  }
  72% {
    opacity: 0.55;
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--float-x, 0px)), calc(-50% + var(--float-y, 0px))) scale(1);
  }
}

@keyframes mergeGlow {
  0% {
    filter: brightness(1.08);
    box-shadow:
      0 0 0 4px rgba(255, 255, 255, 0.82),
      0 0 18px rgba(255, 255, 255, 0.58),
      0 0 34px rgba(255, 255, 255, 0.28);
  }
  45% {
    filter: brightness(1.03);
    box-shadow:
      0 0 0 2px rgba(255, 255, 255, 0.34),
      0 0 12px rgba(255, 255, 255, 0.24),
      0 0 24px rgba(255, 255, 255, 0.12);
  }
  100% {
    filter: brightness(1);
    box-shadow: none;
  }
}

@keyframes mergeFlashTop {
  0% {
    box-shadow:
      inset 0 0 0 999px rgba(255, 255, 255, 0.88),
      inset 0 2px 0 rgba(255, 255, 255, 0.92);
    filter: saturate(0.6) brightness(1.1);
  }
  38% {
    box-shadow:
      inset 0 0 0 999px rgba(255, 255, 255, 0.36),
      inset 0 2px 0 rgba(255, 255, 255, 0.4);
    filter: saturate(0.82) brightness(1.04);
  }
  100% {
    box-shadow: none;
    filter: none;
  }
}

@keyframes mergeScoreFloat {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) translate(0, 0) scale(1);
  }
  42% {
    opacity: 1;
    transform: translate(-50%, -50%) translate(0, -46px) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) translate(var(--merge-score-dx, 0px), var(--merge-score-dy, -120px)) scale(0.58);
  }
}

@media (max-width: 520px) {
  :root {
    --shell-padding-x: 10px;
  }

  body.is-game-screen {
    --game-strip-height: 68px;
    --game-hud-height: 60px;
    --board-size: min(
      calc(100vw - (var(--shell-padding-x) * 2)),
      calc(100dvh - var(--game-chrome-height) - var(--game-shell-padding-y) - var(--game-shell-padding-bottom) - 22px)
    );
  }

  .game-shell {
    gap: 8px;
  }

  .level-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .level-strip {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 6px;
  }

  .level-strip-left {
    gap: 8px;
  }

  .level-strip-side {
    grid-column: auto;
    display: flex;
    justify-content: flex-end;
    align-items: center;
  }

  .level-strip-goal {
    padding: 0 4px;
    font-size: clamp(15px, 4.4vw, 20px);
  }

  .level-strip-meta {
    max-width: none;
    text-align: right;
  }

  .hud {
    min-height: 60px;
  }

  .hud strong {
    font-size: clamp(20px, 6.4vw, 28px);
  }

  .hud-timer {
    min-height: 60px;
  }

  .hud-timer-text {
    left: 14px;
  }

  .hud-timer-track {
    inset: 1px 2px 7px;
  }
}

@font-face {
  font-family: "Rubik Custom";
  src: url("./data/fonts/Rubik-Light.ttf") format("truetype");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
