:root {
  color-scheme: light;
  --design-w: 1080;
  --design-h: 1920;
  --purple: #5a1bd3;
  --purple-dark: #281064;
  --purple-mid: #4214a9;
  --gold: #ffd51f;
  --gold-dark: #e68a08;
  --green: #12c768;
  --green-dark: #078a49;
  --blue: #1e68ad;
  --deep-blue: #062643;
  --cream: #fff2dc;
  --ink: #ffffff;
  --shadow: rgba(26, 8, 75, 0.32);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: #8ed8ff;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.game-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100vw;
  height: 100vh;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

.game-scale {
  position: relative;
  width: min(100vw, calc(100vh * 9 / 16));
  height: min(100vh, calc(100vw * 16 / 9));
  overflow: hidden;
}

.game-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 1080px;
  height: 1920px;
  transform: scale(calc(min(100vw, 100vh * 9 / 16) / 1080));
  transform-origin: top left;
  overflow: hidden;
  border-radius: 0;
  background: #0b1224;
  box-shadow: none;
}

.game-screen.is-playing {
  background: #0b1224;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

#gameCanvas.is-inactive {
  visibility: hidden;
  pointer-events: none;
}

.screen-layer {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  grid-template-rows: auto auto minmax(260px, 1fr) auto;
  gap: 12px;
  padding: 14px 14px 0;
  background:
    radial-gradient(circle at 50% 31%, rgba(255, 219, 73, 0.22), transparent 25%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.06) 0 12px, transparent 12px 38px),
    linear-gradient(180deg, #6924df 0%, #5016c2 48%, #2a126c 100%);
}

.home-screen {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-height: 100%;
  gap: 0;
  padding: 0;
  background: transparent;
  overflow: hidden;
}

.home-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  pointer-events: none;
}

.home-brand,
.home-cta,
.home-footer {
  position: relative;
  z-index: 2;
  pointer-events: auto;
}

.home-brand {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 72px 0 20px;
}

.home-title-stack {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 900px;
}

.home-title-stack::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 38%;
  z-index: 0;
  width: 920px;
  height: 720px;
  transform: translate(-50%, -50%);
  background: radial-gradient(
    circle,
    rgba(255, 220, 90, 0.32) 0%,
    rgba(255, 200, 60, 0.12) 42%,
    transparent 72%
  );
  pointer-events: none;
}

.home-mascots {
  position: relative;
  z-index: 1;
  width: 780px;
  height: auto;
  margin-bottom: 20px;
  filter: drop-shadow(0 8px 14px rgba(23, 32, 51, 0.22));
}

.home-logo {
  position: relative;
  z-index: 2;
  width: 900px;
  height: auto;
  margin-top: 0;
  filter: drop-shadow(0 10px 16px rgba(74, 26, 120, 0.3));
}

.home-cta {
  display: flex;
  justify-content: center;
  flex: 0 0 auto;
  padding: 0;
  margin-bottom: 12px;
}

.asset-button {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  min-height: 0;
  cursor: pointer;
  transition: transform 0.08s ease;
}

.asset-button img {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
  user-select: none;
}

.home-screen .play-button {
  position: static;
  z-index: 1;
  width: 560px;
  min-height: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  text-shadow: none;
  filter: drop-shadow(0 10px 16px rgba(6, 90, 30, 0.35));
  animation: play-bounce 1.1s ease-in-out infinite;
}

.home-screen .play-button:active {
  animation: none;
  transform: translateY(4px) scale(0.96);
}

@keyframes play-bounce {
  0%, 100% {
    transform: translateY(0) scale(1);
  }
  35% {
    transform: translateY(-10px) scale(1.05);
  }
  55% {
    transform: translateY(-4px) scale(1.02);
  }
  75% {
    transform: translateY(-8px) scale(1.04);
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-screen .play-button {
    animation: play-pulse 1.6s ease-in-out infinite;
  }

  @keyframes play-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.04); }
  }
}

.home-footer {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 28px;
  flex: 0 0 auto;
  margin-top: auto;
  padding: 0 0 48px;
}

.footer-icon {
  width: 120px;
  height: 120px;
  flex: 0 0 auto;
  filter: drop-shadow(0 6px 10px rgba(10, 60, 120, 0.3));
}

.footer-icon.footer-toggle:not(.is-on) {
  opacity: 0.45;
  filter: grayscale(0.5) drop-shadow(0 6px 10px rgba(10, 60, 120, 0.3));
}

.footer-icon.footer-nav {
  opacity: 1;
  filter: drop-shadow(0 6px 10px rgba(10, 60, 120, 0.3));
}

.footer-icon:active {
  transform: scale(0.9);
}

.hub-screen {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 0;
  padding: 0;
  background: transparent;
  overflow: hidden;
}

.hub-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.22) 0%, transparent 18%, transparent 62%, rgba(35, 12, 82, 0.35) 100%);
}

.hub-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  pointer-events: none;
}

.hub-resource-row {
  position: relative;
  z-index: 2;
  grid-template-columns: 156px 1fr 360px;
  gap: 20px;
  margin: 28px 28px 0;
  padding: 18px 22px;
  border: 6px solid #ffbf28;
  border-radius: 24px;
  background: rgba(255, 246, 211, 0.92);
  box-shadow: 0 8px 0 #9d5b10, 0 16px 32px rgba(0, 0, 0, 0.18);
  pointer-events: auto;
}

.hub-resource-row .profile-chip,
.hub-resource-row .coin-chip,
.hub-resource-row .heart-chip {
  min-height: 96px;
  border-width: 6px;
  border-radius: 20px;
  font-size: 40px;
  box-shadow: 0 6px 0 #9d5b10;
}

.hub-resource-row .coin-chip {
  gap: 14px;
  padding: 0 24px;
}

.hub-resource-row .coin-mini {
  flex: 0 0 auto;
  width: 58px;
  height: 58px;
  box-shadow: inset 0 0 0 5px #ffb900;
}

.hub-resource-row .heart-chip {
  gap: 10px;
  padding: 0 18px;
}

.hub-resource-row .heart-chip span {
  width: 58px;
  height: 58px;
  margin-right: 0;
  font-size: 34px;
}

.hub-level-pot {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 36px;
  min-height: 0;
  padding: 24px 32px 32px;
  pointer-events: auto;
}

.hub-level-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 720px;
  padding: 40px 32px 48px;
  border: 8px solid #ffbf28;
  border-radius: 36px;
  background: linear-gradient(180deg, #fff9ec 0%, #ffe8b8 100%);
  box-shadow:
    inset 0 4px 0 rgba(255, 255, 255, 0.85),
    0 14px 0 #9d5b10,
    0 28px 48px rgba(0, 0, 0, 0.22);
}

.hub-level-label {
  color: #6b3f1f;
  font-size: 48px;
  font-weight: 950;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hub-level-number {
  margin-top: 8px;
  color: #5a1bd3;
  font-size: 168px;
  font-weight: 950;
  line-height: 0.9;
  text-shadow:
    0 4px 0 rgba(255, 255, 255, 0.9),
    0 8px 20px rgba(90, 27, 211, 0.28);
}

.hub-play-button {
  width: 520px;
  margin-top: 0;
  filter: drop-shadow(0 12px 20px rgba(6, 90, 30, 0.38));
  animation: play-bounce 1.1s ease-in-out infinite;
}

.hub-play-button:active {
  animation: none;
  transform: translateY(4px) scale(0.96);
}

.progress-screen .bottom-nav {
  position: relative;
  z-index: 2;
  margin: 0;
  padding: 20px 16px max(12px, env(safe-area-inset-bottom));
  min-height: 196px;
  border-top: 8px solid #ffbf28;
  background: linear-gradient(180deg, #8d3cf0 0%, #4a13ba 100%);
  box-shadow: 0 -8px 0 rgba(49, 13, 106, 0.65);
  pointer-events: auto;
}

.hub-bottom-nav {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  justify-items: center;
  justify-content: center;
  gap: 20px;
  width: min(440px, 78%);
  max-width: 440px;
  margin: 0 auto;
  padding: 18px 20px max(14px, env(safe-area-inset-bottom));
}

.hub-bottom-nav .nav-button {
  width: 100%;
  max-width: 190px;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: transparent;
  font-size: 0;
}

.hub-bottom-nav .nav-button::before {
  content: none;
  display: none;
}

.hub-bottom-nav .nav-button img {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 auto;
  pointer-events: none;
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.28));
}

.hub-bottom-nav .nav-button.active {
  transform: translateY(-12px);
}

.hub-bottom-nav .nav-button:active {
  transform: translateY(-6px) scale(0.96);
}

.progress-screen .nav-button:not(.asset-button) {
  min-height: 120px;
  font-size: 24px;
}

.progress-screen .nav-button:not(.asset-button)::before {
  width: 72px;
  height: 60px;
  border-width: 5px;
}

.progress-screen .nav-button.active:not(.asset-button)::before {
  width: 96px;
  height: 78px;
}

.progress-screen .profile-chip,
.progress-screen .coin-chip,
.progress-screen .heart-chip {
  min-height: 72px;
  border-width: 5px;
  border-radius: 16px;
  font-size: 28px;
}

.progress-screen .coin-mini {
  width: 44px;
  height: 44px;
}

.progress-screen .heart-chip span {
  width: 44px;
  height: 44px;
}

.daily-screen,
.leaderboard-screen,
.hub-screen {
  gap: 0;
  padding: 0;
}

.hub-screen {
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: transparent;
}

.daily-screen,
.leaderboard-screen {
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 50% 20%, rgba(255, 219, 73, 0.18), transparent 28%),
    linear-gradient(180deg, #6924df 0%, #5016c2 48%, #2a126c 100%);
}

.daily-screen .bottom-nav,
.leaderboard-screen .bottom-nav {
  margin-top: auto;
}

.level-screen {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 22%, rgba(255, 207, 40, 0.18), transparent 22%),
    linear-gradient(180deg, #4f1ec9 0%, #7332d8 46%, #a14db3 76%, #30156f 100%);
}

.levels-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  pointer-events: none;
}

.level-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(circle at 18% 20%, rgba(255, 255, 255, 0.22) 0 1px, transparent 2px),
    radial-gradient(circle at 72% 62%, rgba(255, 225, 122, 0.18) 0 1px, transparent 2px),
    linear-gradient(180deg, rgba(62, 21, 156, 0.08) 0%, rgba(38, 12, 97, 0.12) 52%, rgba(16, 5, 45, 0.28) 100%);
  background-size: 72px 72px, 96px 96px, auto;
}

.level-head {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 24px 24px 14px;
}

.level-back-btn {
  flex: 0 0 auto;
  width: 88px;
  min-height: 88px;
  font-size: 40px;
  font-weight: 950;
  border-width: 5px;
}

.level-title-banner {
  flex: 1;
  position: relative;
  padding: 14px 24px 16px;
  border: 6px solid #ffbf28;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 249, 236, 0.96) 0%, rgba(255, 232, 184, 0.96) 100%);
  box-shadow: 0 8px 0 #9d5b10, 0 16px 32px rgba(0, 0, 0, 0.22);
  text-align: center;
}

.level-title-banner::before,
.level-title-banner::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 34px;
  height: 24px;
  background: linear-gradient(180deg, #ffe467, #ff9218);
  transform: translateY(-50%);
  clip-path: polygon(0 50%, 100% 0, 72% 50%, 100% 100%);
  filter: drop-shadow(0 3px 0 #9d5b10);
}

.level-title-banner::before {
  left: -24px;
}

.level-title-banner::after {
  right: -24px;
  transform: translateY(-50%) scaleX(-1);
}

.level-title-banner .mini-label {
  display: block;
  color: #8a5d92;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.level-title-banner h2 {
  margin: 2px 0 0;
  color: #5a1bd3;
  font-size: 54px;
  font-weight: 950;
  line-height: 0.95;
  text-shadow:
    0 3px 0 rgba(255, 255, 255, 0.85),
    0 5px 0 rgba(102, 45, 150, 0.18);
}

.level-stages {
  position: relative;
  z-index: 2;
  flex: 1;
  overflow-y: auto;
  padding: 8px 20px 32px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.level-stage {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.level-stage-head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 64px;
}

.level-stage-banner {
  display: block;
  width: 100%;
  max-width: 640px;
  height: auto;
  margin: 0 auto;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.24));
}

.level-stage-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 0 32px;
  pointer-events: none;
}

.level-stage-text strong {
  color: #ffffff;
  font-size: 24px;
  font-weight: 950;
  line-height: 1.05;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.28);
}

.level-stage-text span {
  color: rgba(255, 255, 255, 0.92);
  font-size: 16px;
  font-weight: 850;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.22);
}

.daily-screen .panel-title,
.leaderboard-screen .panel-title {
  margin: 24px auto 0;
  padding: 18px 36px;
  font-size: 48px;
  border-width: 6px;
}

.calendar-card {
  margin: 20px 24px 0;
  padding: 0 0 20px;
  border: 6px solid #179bd7;
  border-radius: 24px;
  background: #fff2df;
  overflow: hidden;
}

.calendar-month {
  padding: 14px;
  background: #e61c38;
  color: #ffffff;
  font-size: 36px;
  font-weight: 950;
  text-align: center;
}

.daily-screen .reward-track {
  margin: 20px 24px 0;
  padding: 20px;
  border-width: 6px;
}

.daily-screen .calendar-grid {
  padding: 20px;
  gap: 12px;
}

.daily-screen .calendar-grid span {
  font-size: 28px;
}

.daily-play-button {
  justify-self: center;
  width: 560px;
  margin: 20px auto 0;
  filter: drop-shadow(0 10px 16px rgba(6, 90, 30, 0.35));
}

.leaderboard-screen .rank-tabs {
  margin: 20px 24px 0;
  padding: 10px;
}

.leaderboard-screen .rank-tabs span {
  padding: 16px 8px;
  font-size: 28px;
}

.leaderboard-screen .rank-tabs span.active {
  background: #ff9a19;
  border-radius: 16px;
}

.leaderboard-screen .podium {
  margin: 20px 24px 0;
  min-height: 220px;
  padding: 16px;
}

.leaderboard-screen .podium div {
  height: 120px;
  font-size: 28px;
}

.leaderboard-screen .podium .first {
  height: 170px;
}

.leaderboard-screen .rank-list {
  margin: 16px 24px 0;
  padding: 12px;
}

.leaderboard-screen .rank-list p {
  min-height: 72px;
  font-size: 28px;
  grid-template-columns: 48px 1fr 100px;
}

.resource-row {
  display: grid;
  grid-template-columns: 50px 1fr 88px;
  gap: 8px;
  align-items: center;
}

.profile-chip,
.coin-chip,
.heart-chip {
  min-height: 42px;
  border: 4px solid #ffbf28;
  border-radius: 10px;
  background: #fff6d3;
  color: #3b225a;
  font-weight: 950;
  box-shadow: 0 4px 0 #9d5b10;
}

.profile-chip,
.coin-chip,
.heart-chip,
.coin-mini {
  display: flex;
  align-items: center;
  justify-content: center;
}

.coin-chip {
  gap: 6px;
}

.coin-mini {
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: inset 0 0 0 4px #ffb900;
}

.heart-chip span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin-right: 5px;
  border-radius: 50%;
  background: #e61c38;
  color: #ffffff;
}

.home-top {
  padding: 0 8px;
  text-align: center;
}

.mini-label,
#resultKicker {
  display: block;
  color: #ffe26a;
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0;
}

h1,
h2 {
  margin: 0;
  color: #ffffff;
  letter-spacing: 0;
  text-shadow: 0 4px 0 rgba(0, 0, 0, 0.24);
}

h1 {
  margin-top: 4px;
  font-size: clamp(42px, 8vh, 58px);
  line-height: 0.92;
}

h2 {
  font-size: 34px;
  line-height: 1;
}

.home-top p {
  margin: 8px 0 0;
  color: #ddc9ff;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.35;
}

.level-pot {
  position: relative;
  display: grid;
  align-content: end;
  justify-items: center;
  min-height: 0;
  padding-bottom: 10px;
}

.magic-window {
  position: absolute;
  top: 0;
  width: 86%;
  height: 48%;
  border: 8px solid #ff9a19;
  border-radius: 44% 44% 20px 20px;
  background:
    radial-gradient(circle at 50% 52%, rgba(255, 255, 255, 0.95) 0 16%, rgba(127, 221, 255, 0.95) 17% 47%, #37ace6 48% 70%, #8a54e8 71%);
  box-shadow: inset 0 -8px rgba(0, 0, 0, 0.12), 0 15px 0 rgba(0, 0, 0, 0.1);
}

.pot-bowl {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 72%;
  aspect-ratio: 1.35;
  border-radius: 44% 44% 32% 32%;
  background:
    radial-gradient(circle at 50% 12%, #ff72ff 0 22%, transparent 23%),
    linear-gradient(180deg, #d94df0, #7e22c9 72%);
  color: #35105c;
  border: 8px solid #ff9a19;
  box-shadow: inset 0 -18px rgba(0, 0, 0, 0.16), 0 16px 0 #581699;
}

.pot-bowl span {
  margin-top: 26px;
  color: #5a2672;
  font-size: 24px;
  font-weight: 950;
}

.pot-bowl strong {
  margin-top: -16px;
  color: #611184;
  font-size: 70px;
  line-height: 1;
  text-shadow: 0 3px rgba(255, 255, 255, 0.25);
}

.play-button {
  position: relative;
  z-index: 2;
  width: min(70%, 260px);
  min-height: 68px;
  margin-top: -10px;
  border: 6px solid #ffc42f;
  border-radius: 18px;
  background: linear-gradient(180deg, #7dff42, #16b92d);
  color: #ffffff;
  font-size: 30px;
  font-weight: 950;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.24);
  box-shadow: inset 0 -8px rgba(0, 0, 0, 0.18), 0 7px 0 #087b1d;
}

button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  min-height: 48px;
  border: 0;
  font: inherit;
  font-weight: 950;
  letter-spacing: 0;
}

.bottom-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  padding: 8px 8px max(10px, env(safe-area-inset-bottom));
  border-top: 4px solid #ffbf28;
  background: linear-gradient(180deg, #7d24e4, #4a13ba);
  box-shadow: 0 -5px 0 rgba(49, 13, 106, 0.7);
}

.nav-button {
  flex-direction: column;
  min-height: 64px;
  border-radius: 8px;
  background: transparent;
  color: #fff7d7;
  box-shadow: none;
  font-size: 12px;
}

.nav-button:not(.asset-button)::before {
  content: "";
  display: block;
  width: 38px;
  height: 32px;
  margin-bottom: 3px;
  border: 4px solid #ffbf28;
  border-radius: 10px;
  background: linear-gradient(180deg, #ffdb42, #ff7a17);
}

.nav-button.active:not(.asset-button) {
  transform: translateY(-12px);
}

.nav-button.active:not(.asset-button)::before {
  width: 54px;
  height: 45px;
  border-radius: 16px;
  background: linear-gradient(180deg, #ff5cff, #8d24dd);
}

.level-screen,
.daily-screen,
.leaderboard-screen {
  align-content: stretch;
}

.icon-button {
  flex: 0 0 auto;
  width: 62px;
  min-height: 62px;
  padding: 0;
  border-radius: 50%;
  font-size: 0;
  line-height: 1;
  background: #fff6d3;
  color: #42146d;
  box-shadow: 0 5px 0 #9d5b10;
}

.level-back-btn {
  position: relative;
  border: 5px solid #ffbf28;
  background: linear-gradient(180deg, #fffdf1, #ffd77a);
}

.level-back-btn::before {
  content: "";
  width: 23px;
  height: 23px;
  border-left: 9px solid #5a1bd3;
  border-bottom: 9px solid #5a1bd3;
  transform: rotate(45deg);
  margin-left: 8px;
  filter: drop-shadow(0 2px 0 rgba(255, 255, 255, 0.85));
}

.level-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 0 2px;
  max-width: 560px;
  margin: 0 auto;
}

.level-stage-easy .level-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  max-width: 560px;
}

.level-stage-medium .level-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  max-width: 560px;
}

.level-card {
  position: relative;
  display: block;
  min-height: 0;
  aspect-ratio: 0.92;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  overflow: hidden;
  transition: transform 0.1s ease;
}

.level-card-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.24));
}

.level-card-num {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  color: #ffffff;
  font-size: 36px;
  font-weight: 950;
  line-height: 1;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.28);
}

.level-card:active {
  transform: scale(0.94);
}

.level-stage-hard .level-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: 300px;
}

.level-stage-hard .level-card-num {
  font-size: 40px;
}

.level-card-mode {
  position: absolute;
  left: 50%;
  bottom: 10%;
  z-index: 2;
  transform: translateX(-50%);
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: #5a1bd3;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.2;
  white-space: nowrap;
}

.panel-title {
  margin: 12px auto 0;
  padding: 12px 22px;
  border: 5px solid #ffbf28;
  border-radius: 18px;
  background: #4c17be;
  color: #ffffff;
  font-size: 30px;
  font-weight: 950;
  text-align: center;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.32);
}

.reward-track,
.calendar-grid,
.rank-tabs,
.rank-list,
.podium {
  border: 5px solid #179bd7;
  border-radius: 18px;
  background: #fff2df;
  box-shadow: inset 0 -7px rgba(72, 35, 91, 0.12);
}

.reward-track {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 14px;
  color: #451d73;
  text-align: center;
}

.reward-track strong {
  display: block;
  font-size: 20px;
}

.reward-track span {
  font-size: 11px;
  font-weight: 850;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  padding: 16px;
}

.calendar-grid span {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #ead9c8;
  color: #b17865;
  font-weight: 950;
}

.calendar-grid .done {
  background: #13bd58;
  color: #ffffff;
}

.calendar-grid .today {
  background: #1698e8;
  color: #ffffff;
}

.panel-play {
  justify-self: center;
}

.rank-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 7px;
  background: #4c17be;
}

.rank-tabs span {
  padding: 10px 4px;
  border-radius: 12px;
  color: #ffffff;
  font-weight: 950;
  text-align: center;
}

.rank-tabs span:first-child {
  background: transparent;
}

.podium {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: end;
  min-height: 150px;
  padding: 12px;
  text-align: center;
}

.podium div {
  display: grid;
  place-items: center;
  height: 84px;
  border-radius: 16px 16px 10px 10px;
  background: #f5d7ba;
  color: #5b2e2b;
  font-weight: 950;
}

.podium .first {
  height: 122px;
  background: #ffe184;
}

.rank-list {
  display: grid;
  gap: 8px;
  padding: 10px;
}

.rank-list p {
  display: grid;
  grid-template-columns: 32px 1fr 70px;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  margin: 0;
  padding: 6px 10px;
  border-radius: 12px;
  background: #fff8ef;
  color: #4a235a;
  font-weight: 900;
}

.rank-list p:first-child {
  background: #67e31e;
}

.hud {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 2;
  pointer-events: none;
}

.top-hud {
  top: 0;
  height: 118px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: max(12px, env(safe-area-inset-top)) 18px 12px;
  background: var(--blue);
  pointer-events: auto;
}

.play-hud.top-hud {
  height: auto;
  min-height: 0;
  padding: 36px 40px 0;
  background: transparent;
  pointer-events: none;
  display: grid;
  grid-template-columns: 104px 1fr 88px;
  align-items: center;
  gap: 12px;
}

.play-status-bar {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 10px;
  min-width: 0;
  pointer-events: none;
}

.play-status-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 128px;
  padding: 10px 18px 12px;
  border: 5px solid #ffbf28;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 252, 244, 0.97) 0%, rgba(255, 236, 196, 0.97) 100%);
  box-shadow: 0 6px 0 #9d5b10, 0 10px 22px rgba(0, 0, 0, 0.18);
}

.play-status-label {
  color: #8a5d92;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.1em;
  line-height: 1;
}

.play-status-chip strong {
  color: #5a1bd3;
  font-size: 40px;
  font-weight: 950;
  line-height: 1;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.65);
}

.play-timer-chip.is-low {
  border-color: #ff5f8f;
  background: linear-gradient(180deg, rgba(255, 244, 246, 0.98) 0%, rgba(255, 214, 224, 0.98) 100%);
  box-shadow: 0 6px 0 #b83258, 0 10px 22px rgba(0, 0, 0, 0.18);
}

.play-timer-chip.is-low strong {
  color: #d62850;
}

.play-timer-chip.is-low .play-status-label {
  color: #c43d5f;
}

.play-hud.bottom-hud {
  bottom: 0;
  padding: 0 0 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  background: transparent;
}

.play-hud .play-icon-btn {
  pointer-events: auto;
  width: 88px;
  height: 88px;
  min-height: 88px;
  padding: 0;
  border: none;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.32));
}

.play-hud .play-icon-btn:active {
  transform: scale(0.94);
}

.play-hud .play-refresh-btn {
  width: 104px;
  height: 104px;
  min-height: 104px;
}

.play-actions {
  display: flex;
  gap: 14px;
  justify-content: center;
  align-items: center;
  pointer-events: auto;
  flex-wrap: wrap;
  max-width: 100%;
  padding: 0 12px;
}

.play-actions-three {
  display: grid;
  grid-template-columns: repeat(3, 108px);
  gap: 28px;
  justify-content: center;
  align-items: end;
}

.play-actions-three .play-action-btn {
  position: relative;
  width: 108px;
  height: 108px;
  min-height: 108px;
  flex: none;
  padding: 0;
  border: none;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.32));
  display: block;
  overflow: visible;
}

.play-actions-three .play-action-btn img {
  display: block;
  width: 108px;
  height: 108px;
  object-fit: contain;
  pointer-events: none;
}

.play-actions-three .play-action-btn:active {
  transform: scale(0.94);
}

.play-action-btn,
.play-nav-btn {
  position: relative;
  width: 112px;
  height: 112px;
  min-height: 112px;
  padding: 0;
  border: none;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.32));
}

.play-action-btn:active,
.play-nav-btn:active {
  transform: scale(0.94);
}

.play-action-btn img,
.play-nav-btn img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.play-hint-btn.is-depleted {
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.32)) grayscale(0.7) opacity(0.55);
}

.hint-count-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 40px;
  height: 40px;
  padding: 0 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 4px solid #ffffff;
  border-radius: 999px;
  background: linear-gradient(180deg, #ff5f8f, #d62850);
  color: #ffffff;
  font-size: 24px;
  font-weight: 950;
  line-height: 1;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.25);
  pointer-events: none;
}

.play-hint-btn.is-depleted .hint-count-badge {
  background: linear-gradient(180deg, #9aa0a8, #6b7078);
}

.play-hint-toast {
  pointer-events: none;
  margin: 0;
  padding: 20px 40px;
  border-radius: 24px;
  background: rgba(13, 21, 40, 0.88);
  color: #ffffff;
  font-size: 36px;
  font-weight: 700;
  text-align: center;
  max-width: 900px;
  line-height: 1.3;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

.pause-button {
  flex: 0 0 auto;
  width: 70px;
  height: 70px;
  min-height: 70px;
  padding: 0;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 6px 0 #0d3c67;
  gap: 8px;
}

.pause-button span {
  width: 11px;
  height: 36px;
  border-radius: 999px;
  background: var(--blue);
}

.level-title {
  flex: 1;
  color: #ffffff;
  text-align: center;
  line-height: 1.08;
}

.level-title span,
.level-title strong {
  display: block;
  font-weight: 950;
  letter-spacing: 0;
}

.level-title span {
  font-size: 27px;
}

.level-title strong {
  font-size: 31px;
}

.coin-pill {
  position: relative;
  flex: 0 0 138px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 20px 0 52px;
  border-radius: 999px;
  background: var(--deep-blue);
  color: #ffffff;
}

.coin-pill strong {
  font-size: 31px;
  font-weight: 500;
}

.coin-mark,
.mini-coin {
  display: block;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: inset 0 0 0 6px #ffb900, inset 0 0 0 12px #ffe455;
}

.coin-mark {
  position: absolute;
  left: -5px;
  width: 66px;
  height: 66px;
}

.bottom-hud {
  bottom: 26px;
  padding: 0 72px;
  pointer-events: auto;
  background: transparent;
}

#hintText {
  margin: 0;
}

#hintText.play-hint-toast {
  position: static;
}

.actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px;
}

.round-action {
  position: relative;
  min-height: 84px;
  height: 84px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 8px 0 var(--green-dark), 0 14px 18px rgba(5, 113, 66, 0.24);
}

.round-action:active {
  transform: translateY(3px);
  box-shadow: 0 5px 0 var(--green-dark), 0 10px 16px rgba(5, 113, 66, 0.18);
}

.chevron-left {
  width: 31px;
  height: 31px;
  border-left: 10px solid #ffffff;
  border-bottom: 10px solid #ffffff;
  transform: rotate(45deg);
}

.retry-mark {
  width: 45px;
  height: 45px;
  border: 9px solid #ffffff;
  border-left-color: transparent;
  border-radius: 50%;
  transform: rotate(-35deg);
}

.retry-mark::before {
  content: "";
  position: absolute;
  width: 0;
  height: 0;
  margin-top: 22px;
  margin-left: -10px;
  border-top: 11px solid transparent;
  border-bottom: 11px solid transparent;
  border-right: 18px solid #ffffff;
}

.bulb-mark {
  position: relative;
  width: 34px;
  height: 43px;
  border-radius: 50% 50% 45% 45%;
  background: #ffffff;
}

.bulb-mark::after {
  content: "";
  position: absolute;
  left: 10px;
  bottom: -8px;
  width: 14px;
  height: 12px;
  border-radius: 4px;
  background: #ffffff;
}

.hint-action small {
  position: absolute;
  right: 4px;
  bottom: 5px;
  display: flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  padding: 0 8px 0 4px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.65);
  color: #ffffff;
  font-size: 16px;
  font-weight: 850;
}

.mini-coin {
  width: 24px;
  height: 24px;
  box-shadow: inset 0 0 0 3px #ffb900, inset 0 0 0 6px #ffe455;
}

#gameCanvas.is-blurred {
  filter: blur(10px) brightness(0.72);
}

.win-screen {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  pointer-events: auto;
  overflow: hidden;
}

.win-confetti {
  position: absolute;
  inset: 0;
  z-index: 3;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.win-backdrop {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: rgba(6, 10, 24, 0.62);
  backdrop-filter: blur(16px);
}

.win-content {
  position: relative;
  z-index: 2;
  width: 860px;
  margin-top: -20px;
  animation: win-pop 0.45s cubic-bezier(0.22, 1.1, 0.36, 1) both;
}

.win-content::after {
  content: "";
  position: absolute;
  inset: 2% 4% 8%;
  border-radius: 28px;
  box-shadow: inset 0 0 60px rgba(255, 248, 220, 0.18);
  pointer-events: none;
}

.win-modal {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 24px;
  filter: saturate(1.05) brightness(1.02);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.win-rewards {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.win-coin-value,
.win-diamond-value {
  position: absolute;
  top: 56.5%;
  color: #6b3f1f;
  font-size: 48px;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.35);
}

.win-coin-value {
  left: 41%;
  transform: translateX(-50%);
}

.win-diamond-value {
  left: 66%;
  transform: translateX(-50%);
}

.win-actions {
  position: absolute;
  left: 50%;
  bottom: 8.5%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: 52%;
}

.win-btn {
  flex: 1 1 0;
  max-width: 168px;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.24));
}

.win-btn img {
  display: block;
  width: 100%;
  height: auto;
}

.win-btn:active {
  transform: scale(0.96);
}

@keyframes win-pop {
  0% {
    opacity: 0;
    transform: scale(0.82) translateY(40px);
  }

  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.fail-screen {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  pointer-events: auto;
}

.fail-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 14, 30, 0.42);
}

.fail-content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  width: 860px;
  margin-top: -60px;
  animation: fail-pop 0.4s cubic-bezier(0.22, 1.05, 0.36, 1) both;
}

.fail-title {
  width: 78%;
  max-width: 720px;
  height: auto;
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.35));
}

.fail-subtitle {
  width: 88%;
  max-width: 820px;
  height: auto;
  margin-top: -8px;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.4));
}

.fail-mascot {
  width: 340px;
  height: auto;
  margin: 8px 0 12px;
  filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.3));
  animation: fail-bounce 1.8s ease-in-out infinite;
}

.fail-retry-btn {
  width: 72%;
  max-width: 620px;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.32));
}

.fail-retry-btn img {
  display: block;
  width: 100%;
  height: auto;
}

.fail-retry-btn:active {
  transform: scale(0.96);
}

@keyframes fail-pop {
  0% {
    opacity: 0;
    transform: scale(0.88) translateY(30px);
  }

  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes fail-bounce {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-10px);
  }
}

.settings-panel {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  pointer-events: auto;
}

.settings-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 12, 28, 0.55);
  backdrop-filter: blur(10px);
}

.settings-card {
  position: relative;
  z-index: 1;
  width: min(860px, 92%);
  max-height: 86%;
  overflow-y: auto;
  padding: 28px 32px 32px;
  border: 8px solid #ffbf28;
  border-radius: 28px;
  background: linear-gradient(180deg, #fff9ec 0%, #ffe8b8 100%);
  box-shadow: 0 14px 0 #9d5b10, 0 28px 48px rgba(0, 0, 0, 0.28);
  color: #43186e;
}

.settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.settings-head h2 {
  margin: 0;
  font-size: 44px;
  font-weight: 950;
  line-height: 1;
  color: #5a1bd3;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.65);
}

.settings-section h3 {
  margin: 0 0 12px;
  font-size: 28px;
  font-weight: 950;
  color: #5a1bd3;
  text-shadow: none;
}

.settings-close {
  width: 56px;
  height: 56px;
  border: 4px solid #ffbf28;
  border-radius: 50%;
  background: #ffffff;
  color: #5a1bd3;
  font-size: 36px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
}

.settings-section {
  margin-bottom: 22px;
}

.settings-audio-row {
  display: flex;
  justify-content: center;
  gap: 24px;
}

.settings-audio-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 140px;
  padding: 0;
  border: 0;
  background: transparent;
  opacity: 0.45;
  filter: grayscale(0.45);
  transition: opacity 0.12s ease, filter 0.12s ease, transform 0.08s ease;
}

.settings-audio-btn.is-on {
  opacity: 1;
  filter: none;
}

.settings-audio-btn img {
  width: 100%;
  height: auto;
}

.settings-audio-btn span {
  color: #5a1bd3;
  font-size: 22px;
  font-weight: 900;
}

.settings-audio-btn:active {
  transform: scale(0.94);
}

.settings-guide ol {
  margin: 0;
  padding-left: 28px;
  display: grid;
  gap: 10px;
}

.settings-guide li {
  font-size: 24px;
  font-weight: 750;
  line-height: 1.45;
  color: #3d1a52;
}

.settings-guide strong {
  color: #5a1bd3;
}

[hidden] {
  display: none !important;
}

@media (max-width: 430px) {
  .screen-layer {
    gap: 10px;
    padding: 0;
  }

  .home-screen {
    gap: 0;
    padding: 0;
  }

  h1 {
    font-size: 46px;
  }

  .top-hud {
    height: 108px;
    padding-left: 14px;
    padding-right: 14px;
  }

  .play-hud.top-hud {
    height: auto;
    padding: 36px 28px 0;
    grid-template-columns: 118px 1fr 100px;
    gap: 8px;
  }

  .play-status-chip {
    min-width: 108px;
    padding: 8px 12px 10px;
  }

  .play-status-label {
    font-size: 15px;
  }

  .play-status-chip strong {
    font-size: 34px;
  }

  .play-hud .play-icon-btn {
    width: 100px;
    height: 100px;
    min-height: 100px;
  }

  .play-hud .play-refresh-btn {
    width: 118px;
    height: 118px;
    min-height: 118px;
  }

  .play-action-btn,
  .play-nav-btn {
    width: 120px;
    height: 120px;
    min-height: 120px;
  }

  .play-actions-three {
    grid-template-columns: repeat(3, 120px);
    gap: 32px;
  }

  .play-actions-three .play-action-btn,
  .play-actions-three .play-action-btn img {
    width: 120px;
    height: 120px;
    min-height: 120px;
  }

  .play-hint-toast {
    font-size: 28px;
    padding: 16px 28px;
  }

  .play-hud.bottom-hud {
    padding-bottom: 56px;
  }

  .win-content {
    width: 88vw;
    max-width: 920px;
  }

  .win-coin-value,
  .win-diamond-value {
    font-size: 40px;
  }

  .win-actions {
    width: 64%;
    gap: 14px;
  }

  .win-btn {
    max-width: 180px;
  }

  .fail-content {
    width: 88vw;
    max-width: 860px;
    gap: 20px;
  }

  .fail-mascot {
    width: 260px;
  }

  .pause-button {
    width: 60px;
    height: 60px;
    min-height: 60px;
  }

  .level-title-banner h2 {
    font-size: 34px;
  }

  .level-card-num {
    font-size: 32px;
  }

  .level-stage-text strong {
    font-size: 22px;
  }

  .level-title span {
    font-size: 22px;
  }

  .level-title strong {
    font-size: 26px;
  }

  .coin-pill {
    flex-basis: 106px;
    height: 48px;
    padding-right: 12px;
    padding-left: 42px;
  }

  .coin-pill strong {
    font-size: 24px;
  }

  .coin-mark {
    width: 54px;
    height: 54px;
  }

  .bottom-hud {
    bottom: 22px;
    padding: 0 48px;
  }

  .actions {
    gap: 24px;
  }

  .round-action {
    min-height: 78px;
    height: 78px;
  }

  .panel-title {
    font-size: 26px;
  }
}

.level-stages {
  justify-content: flex-start;
  gap: 26px;
  padding: 18px 42px 40px;
  overflow-y: auto;
}

.stage-choice {
  position: relative;
  width: 100%;
  min-height: 96px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: 8px solid #ffcf28;
  border-radius: 999px;
  color: #ffffff;
  text-align: center;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.3);
  box-shadow:
    inset 0 9px rgba(255, 255, 255, 0.34),
    inset 0 -10px rgba(0, 0, 0, 0.2),
    0 7px 0 #8f5b08,
    0 16px 24px rgba(21, 4, 58, 0.34);
}

.stage-choice::before,
.stage-choice::after {
  content: "";
  position: absolute;
  top: 26px;
  width: 54px;
  height: 46px;
  background: linear-gradient(180deg, #ffe36a, #ff9316);
  clip-path: polygon(0 50%, 100% 0, 76% 50%, 100% 100%);
  z-index: -1;
}

.stage-choice::before {
  left: -38px;
}

.stage-choice::after {
  right: -38px;
  transform: scaleX(-1);
}

.stage-choice-easy {
  background: linear-gradient(180deg, #baff28 0%, #5edb12 48%, #16a510 100%);
}

.stage-choice-medium {
  background: linear-gradient(180deg, #19dfff 0%, #0489ff 52%, #0168da 100%);
}

.stage-choice-hard {
  background: linear-gradient(180deg, #ff3e76 0%, #ef0a45 52%, #c90032 100%);
}

.stage-choice.is-locked {
  filter: saturate(0.86);
  opacity: 0.9;
}

.stage-choice span,
.stage-choice strong,
.stage-choice em,
.stage-choice small {
  position: relative;
  z-index: 1;
  display: block;
}

.stage-choice span {
  font-size: 13px;
  font-weight: 950;
}

.stage-choice strong {
  font-size: 20px;
  line-height: 1.05;
}

.stage-choice em,
.stage-choice small {
  color: #fff8d7;
  font-size: 11px;
  font-style: normal;
  font-weight: 850;
}

@media (max-width: 430px) {
  .level-stages {
    gap: 22px;
    padding: 16px 36px 36px;
  }

  .stage-choice {
    min-height: 86px;
  }

  .stage-choice strong {
    font-size: 18px;
  }
}

.level-stages {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-content: start;
  gap: 18px;
  padding: 24px 30px 40px;
  overflow-y: auto;
}

.level-tile {
  position: relative;
  aspect-ratio: 1;
  min-height: 0;
  border: 0;
  border-radius: 20px;
  background:
    radial-gradient(circle at 26% 20%, rgba(255, 255, 255, 0.82) 0 9%, transparent 10%),
    linear-gradient(180deg, #f5d283 0%, #d19a45 55%, #9a6130 100%);
  color: #f8cf82;
  box-shadow:
    inset 0 6px rgba(255, 255, 255, 0.42),
    inset 0 -10px rgba(93, 52, 24, 0.36),
    0 5px 0 #6c3f22,
    0 10px 18px rgba(21, 4, 58, 0.22);
  overflow: visible;
}

.level-tile::before {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 15px;
  border: 4px solid rgba(255, 234, 173, 0.42);
  box-shadow: inset 0 0 0 3px rgba(106, 62, 29, 0.18);
}

.level-tile::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 20px;
  background:
    repeating-linear-gradient(90deg, transparent 0 12px, rgba(104, 62, 29, 0.13) 12px 15px),
    linear-gradient(135deg, rgba(255, 255, 255, 0.22), transparent 42%);
  pointer-events: none;
}

.level-tile strong {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  color: #f4c36c;
  font-size: clamp(42px, 9vw, 62px);
  font-weight: 950;
  line-height: 1;
  text-shadow:
    0 4px 0 rgba(105, 58, 24, 0.52),
    0 -2px 0 rgba(255, 250, 210, 0.65);
}

.level-tile.is-active {
  background:
    radial-gradient(circle at 26% 20%, rgba(255, 255, 255, 0.82) 0 9%, transparent 10%),
    linear-gradient(180deg, #83e1e6 0%, #29aac4 58%, #13718c 100%);
  color: #1b8fb4;
  box-shadow:
    inset 0 6px rgba(255, 255, 255, 0.52),
    inset 0 -10px rgba(15, 83, 103, 0.32),
    0 5px 0 #075c75,
    0 10px 18px rgba(21, 4, 58, 0.22);
}

.level-tile.is-active strong {
  color: #168fb8;
  text-shadow:
    0 4px 0 rgba(6, 76, 99, 0.42),
    0 -2px 0 rgba(213, 255, 255, 0.82);
}

.tile-star {
  position: absolute;
  top: -13px;
  right: -6px;
  z-index: 4;
  width: 43px;
  height: 43px;
  display: none;
  background: #ffbf28;
  clip-path: polygon(50% 0, 63% 33%, 98% 35%, 70% 56%, 79% 91%, 50% 70%, 21% 91%, 30% 56%, 2% 35%, 37% 33%);
  filter: drop-shadow(0 3px 0 #b85b08);
}

.level-tile.is-active .tile-star {
  display: block;
}

.tile-lock {
  position: absolute;
  top: -18px;
  right: 8px;
  z-index: 4;
  width: 36px;
  height: 34px;
  display: block;
  border: 5px solid #7a4c24;
  border-radius: 8px;
  background: #e7b663;
  box-shadow: inset 0 3px rgba(255, 244, 191, 0.5), 0 3px 0 #5f371d;
}

.tile-lock::before {
  content: "";
  position: absolute;
  left: 6px;
  top: -25px;
  width: 16px;
  height: 26px;
  border: 6px solid #7a4c24;
  border-bottom: 0;
  border-radius: 18px 18px 0 0;
  background: transparent;
}

.tile-lock::after {
  content: "";
  position: absolute;
  left: 13px;
  top: 11px;
  width: 8px;
  height: 11px;
  border-radius: 5px;
  background: #6b3919;
}

.level-tile.is-active .tile-lock {
  display: none;
}

@media (max-width: 430px) {
  .level-stages {
    gap: 15px;
    padding: 20px 24px 36px;
  }

  .level-tile {
    border-radius: 16px;
  }

  .level-tile strong {
    font-size: 42px;
  }

  .tile-lock {
    transform: scale(0.82);
    transform-origin: top right;
  }

  .tile-star {
    transform: scale(0.85);
    transform-origin: top right;
  }
}

.level-screen {
  background:
    radial-gradient(circle at 50% 20%, rgba(255, 210, 66, 0.22), transparent 24%),
    linear-gradient(180deg, #5122ca 0%, #7134d6 45%, #a856b4 76%, #2b126d 100%);
}

.level-title-banner h2 {
  font-size: 54px;
  line-height: 0.95;
}

.level-title-banner .mini-label {
  font-size: 18px;
}

.level-back-btn {
  width: 62px;
  min-height: 62px;
}

@media (max-width: 430px) {
  .level-head {
    padding: 14px 12px 10px;
    gap: 10px;
  }

  .level-title-banner {
    padding: 10px 12px 12px;
  }

  .level-title-banner h2 {
    font-size: 36px;
  }

  .level-title-banner .mini-label {
    font-size: 12px;
  }

  .level-back-btn {
    width: 46px;
    min-height: 46px;
    border-width: 4px;
  }

  .level-back-btn::before {
    width: 17px;
    height: 17px;
    border-left-width: 7px;
    border-bottom-width: 7px;
    margin-left: 6px;
  }
}

.levels-bg {
  display: none !important;
}

.level-screen {
  background:
    radial-gradient(circle at 18% 14%, rgba(255, 255, 255, 0.24), transparent 20%),
    radial-gradient(circle at 82% 22%, rgba(255, 213, 74, 0.18), transparent 22%),
    linear-gradient(180deg, #5430c6 0%, #6d38cb 45%, #7b47bc 100%);
}

.level-screen::after {
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.32) 0 1px, transparent 2px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(32, 11, 91, 0.1));
  background-size: 54px 54px, auto;
}

.level-stages {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 18px 18px 34px;
}

.level-tile {
  border-radius: 14px;
  transform: scale(0.96);
  transform-origin: center;
}

.level-tile::before {
  inset: 5px;
  border-radius: 10px;
  border-width: 3px;
}

.level-tile::after {
  border-radius: 14px;
}

.level-tile strong {
  font-size: clamp(30px, 6.6vw, 45px);
}

.tile-lock {
  top: -12px;
  right: 4px;
  transform: scale(0.72);
  transform-origin: top right;
}

.tile-star {
  top: -8px;
  right: -5px;
  transform: scale(0.78);
  transform-origin: top right;
}

@media (max-width: 430px) {
  .level-stages {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 9px;
    padding: 14px 12px 28px;
  }

  .level-tile {
    border-radius: 12px;
  }

  .level-tile strong {
    font-size: 30px;
  }
}

.level-screen[data-pack="1"] {
  background:
    radial-gradient(circle at 20% 16%, rgba(255, 255, 255, 0.42), transparent 20%),
    radial-gradient(circle at 78% 24%, rgba(255, 221, 84, 0.28), transparent 22%),
    linear-gradient(180deg, #42c7ee 0%, #4aa9e9 44%, #2b6ed0 100%);
}

.level-screen[data-pack="2"] {
  background:
    radial-gradient(circle at 18% 14%, rgba(255, 255, 255, 0.24), transparent 20%),
    radial-gradient(circle at 82% 22%, rgba(255, 213, 74, 0.18), transparent 22%),
    linear-gradient(180deg, #5430c6 0%, #6d38cb 45%, #7b47bc 100%);
}

.level-screen[data-pack="3"] {
  background:
    radial-gradient(circle at 20% 16%, rgba(255, 227, 120, 0.34), transparent 21%),
    radial-gradient(circle at 78% 24%, rgba(255, 122, 74, 0.28), transparent 24%),
    linear-gradient(180deg, #f55a38 0%, #c62f58 48%, #59216f 100%);
}

.level-tile[data-pack="2"].is-locked {
  background:
    radial-gradient(circle at 26% 20%, rgba(255, 255, 255, 0.78) 0 9%, transparent 10%),
    linear-gradient(180deg, #d8a8ff 0%, #9a5bd8 55%, #633196 100%);
}

.level-tile[data-pack="2"].is-locked strong {
  color: #e9c6ff;
  text-shadow:
    0 4px 0 rgba(74, 27, 113, 0.54),
    0 -2px 0 rgba(255, 235, 255, 0.62);
}

.level-tile[data-pack="3"].is-locked {
  background:
    radial-gradient(circle at 26% 20%, rgba(255, 255, 255, 0.78) 0 9%, transparent 10%),
    linear-gradient(180deg, #ffbd67 0%, #e85832 55%, #9f2434 100%);
}

.level-tile[data-pack="3"].is-locked strong {
  color: #ffd092;
  text-shadow:
    0 4px 0 rgba(119, 37, 33, 0.58),
    0 -2px 0 rgba(255, 240, 204, 0.62);
}

/* Premium level card refresh */
.level-screen {
  background:
    radial-gradient(circle at 18% 10%, rgba(255, 255, 255, 0.32), transparent 20%),
    radial-gradient(circle at 82% 18%, rgba(255, 226, 104, 0.22), transparent 22%),
    linear-gradient(180deg, #71cfff 0%, #63a9ef 44%, #386fd1 100%);
}

.level-screen::after {
  background:
    linear-gradient(rgba(255, 255, 255, 0.13) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.12) 1px, transparent 1px),
    radial-gradient(circle at 24% 20%, rgba(255, 255, 255, 0.24), transparent 18%),
    linear-gradient(180deg, transparent, rgba(17, 35, 102, 0.13));
  background-size: 34px 34px, 34px 34px, auto, auto;
}

.level-screen[data-pack="1"] {
  background:
    radial-gradient(circle at 18% 10%, rgba(255, 255, 255, 0.35), transparent 20%),
    radial-gradient(circle at 82% 18%, rgba(255, 226, 104, 0.24), transparent 22%),
    linear-gradient(180deg, #72d6ff 0%, #62aaf0 44%, #386fd1 100%);
}

.level-screen[data-pack="2"] {
  background:
    radial-gradient(circle at 18% 10%, rgba(255, 255, 255, 0.22), transparent 20%),
    radial-gradient(circle at 82% 18%, rgba(255, 218, 95, 0.22), transparent 22%),
    linear-gradient(180deg, #9c63f2 0%, #6d3fd1 48%, #3e208e 100%);
}

.level-screen[data-pack="3"] {
  background:
    radial-gradient(circle at 18% 10%, rgba(255, 244, 168, 0.28), transparent 20%),
    radial-gradient(circle at 82% 18%, rgba(255, 138, 72, 0.28), transparent 22%),
    linear-gradient(180deg, #ff944f 0%, #e24852 48%, #6a236e 100%);
}

.level-stages {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  padding: 18px 15px 34px;
}

.level-tile {
  position: relative;
  min-height: 102px;
  border: 4px solid #784318;
  border-radius: 21px;
  overflow: visible;
  transform: scale(0.92) rotate(-1deg);
  background:
    radial-gradient(circle at 22% 18%, rgba(255, 255, 255, 0.9) 0 11%, transparent 12%),
    linear-gradient(90deg, rgba(105, 56, 22, 0.13) 1px, transparent 1px),
    linear-gradient(180deg, #f8d88b 0%, #d7993b 47%, #a86424 100%);
  background-size: auto, 12px 100%, auto;
  box-shadow:
    0 8px 0 #5f3316,
    0 13px 14px rgba(42, 17, 76, 0.24),
    inset 0 3px 0 rgba(255, 255, 255, 0.52),
    inset 0 -8px 0 rgba(92, 45, 18, 0.28);
  cursor: pointer;
}

.level-tile:nth-child(even) {
  transform: scale(0.92) rotate(1deg);
}

.level-tile::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 3px solid rgba(255, 237, 176, 0.72);
  border-radius: 15px;
  box-shadow:
    inset 0 0 0 2px rgba(107, 56, 22, 0.22),
    0 1px 0 rgba(255, 255, 255, 0.36);
  pointer-events: none;
  z-index: 1;
}

.level-tile::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.48) 0 17%, transparent 18% 100%),
    radial-gradient(circle at 74% 78%, rgba(80, 34, 12, 0.15), transparent 28%);
  pointer-events: none;
  z-index: 1;
}

.level-tile:hover,
.level-tile:focus-visible {
  transform: scale(0.96) translateY(-3px);
  box-shadow:
    0 10px 0 #5f3316,
    0 18px 20px rgba(42, 17, 76, 0.28),
    inset 0 3px 0 rgba(255, 255, 255, 0.58),
    inset 0 -8px 0 rgba(92, 45, 18, 0.28);
}

.level-tile strong {
  position: relative;
  z-index: 2;
  color: #ffe0a0;
  font-size: clamp(36px, 7.4vw, 56px);
  line-height: 1;
  -webkit-text-stroke: 1px rgba(124, 67, 21, 0.5);
  text-shadow:
    0 4px 0 #9b5b1e,
    0 -2px 0 rgba(255, 249, 216, 0.85),
    0 7px 8px rgba(61, 24, 10, 0.3);
}

.level-tile.is-active {
  border-color: #0a7f95;
  background:
    radial-gradient(circle at 22% 18%, rgba(255, 255, 255, 0.92) 0 11%, transparent 12%),
    linear-gradient(90deg, rgba(255, 255, 255, 0.16) 1px, transparent 1px),
    linear-gradient(180deg, #94f2ff 0%, #27bdd4 48%, #04759b 100%);
  background-size: auto, 12px 100%, auto;
  box-shadow:
    0 8px 0 #07566e,
    0 13px 18px rgba(12, 91, 135, 0.35),
    0 0 0 4px rgba(255, 224, 73, 0.72),
    inset 0 3px 0 rgba(255, 255, 255, 0.65),
    inset 0 -8px 0 rgba(4, 87, 115, 0.3);
}

.level-tile.is-active::before {
  border-color: rgba(199, 255, 255, 0.9);
  box-shadow:
    inset 0 0 0 2px rgba(1, 94, 126, 0.2),
    0 1px 0 rgba(255, 255, 255, 0.52);
}

.level-tile.is-active strong {
  color: #0a86b8;
  -webkit-text-stroke: 1px rgba(255, 255, 255, 0.52);
  text-shadow:
    0 4px 0 rgba(255, 255, 255, 0.46),
    0 -2px 0 rgba(176, 255, 255, 0.9),
    0 7px 8px rgba(2, 69, 105, 0.28);
}

.level-tile.is-locked {
  cursor: default;
  filter: saturate(0.96);
}

.level-tile[data-pack="2"].is-locked {
  border-color: #4c2784;
  background:
    radial-gradient(circle at 22% 18%, rgba(255, 255, 255, 0.86) 0 11%, transparent 12%),
    linear-gradient(90deg, rgba(255, 255, 255, 0.12) 1px, transparent 1px),
    linear-gradient(180deg, #d9b2ff 0%, #9864e3 49%, #5a2b9a 100%);
  background-size: auto, 12px 100%, auto;
  box-shadow:
    0 8px 0 #351d63,
    0 13px 14px rgba(39, 17, 86, 0.25),
    inset 0 3px 0 rgba(255, 255, 255, 0.52),
    inset 0 -8px 0 rgba(61, 28, 111, 0.3);
}

.level-tile[data-pack="2"].is-locked strong {
  color: #f0d8ff;
  -webkit-text-stroke: 1px rgba(91, 43, 154, 0.42);
  text-shadow:
    0 4px 0 rgba(87, 39, 145, 0.7),
    0 -2px 0 rgba(255, 244, 255, 0.84),
    0 7px 8px rgba(46, 18, 92, 0.32);
}

.level-tile[data-pack="3"].is-locked {
  border-color: #842631;
  background:
    radial-gradient(circle at 22% 18%, rgba(255, 255, 255, 0.84) 0 11%, transparent 12%),
    linear-gradient(90deg, rgba(255, 255, 255, 0.1) 1px, transparent 1px),
    linear-gradient(180deg, #ffd07b 0%, #f06b37 49%, #af243e 100%);
  background-size: auto, 12px 100%, auto;
  box-shadow:
    0 8px 0 #681d2a,
    0 13px 14px rgba(74, 19, 43, 0.24),
    inset 0 3px 0 rgba(255, 255, 255, 0.5),
    inset 0 -8px 0 rgba(103, 29, 38, 0.32);
}

.level-tile[data-pack="3"].is-locked strong {
  color: #ffe0a4;
  -webkit-text-stroke: 1px rgba(149, 48, 34, 0.42);
  text-shadow:
    0 4px 0 rgba(157, 51, 31, 0.74),
    0 -2px 0 rgba(255, 248, 222, 0.82),
    0 7px 8px rgba(80, 23, 28, 0.32);
}

.tile-lock {
  top: -13px;
  right: -3px;
  z-index: 4;
  transform: scale(0.74) rotate(8deg);
  filter: drop-shadow(0 4px 0 rgba(72, 35, 13, 0.34));
}

.tile-star {
  top: -14px;
  right: -8px;
  z-index: 4;
  transform: scale(0.88) rotate(11deg);
  filter: drop-shadow(0 4px 0 rgba(93, 52, 4, 0.32));
}

@media (max-width: 430px) {
  .level-stages {
    gap: 10px;
    padding: 14px 11px 30px;
  }

  .level-tile {
    min-height: 96px;
    border-width: 3px;
    border-radius: 18px;
  }

  .level-tile::before {
    inset: 5px;
    border-width: 2px;
    border-radius: 13px;
  }

  .level-tile strong {
    font-size: 34px;
  }

  .tile-lock {
    right: -7px;
    transform: scale(0.62) rotate(8deg);
  }

  .tile-star {
    right: -10px;
    transform: scale(0.72) rotate(11deg);
  }
}
