:root {
  --navy: #101936;
  --navy-2: #172650;
  --ink: #18213a;
  --muted: #6f7890;
  --surface: #f6f7fb;
  --white: #ffffff;
  --indigo: #4b5cff;
  --mint: #35d8b0;
  --coral: #ff6577;
  --campaign-blue: #4b5cff;
  --campaign-indigo: #3a4de0;
  --campaign-cyan: #3ecfff;
  --campaign-bg: #eaf6ff;
  --campaign-path: #c5d3ee;
  --node-size: 52px;
  --node-current: 68px;
  font-family: "Nunito", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #080d1c;
}
button {
  font: inherit;
}

.game-shell {
  position: relative;
  width: min(100vw, 56.25vh);
  height: min(100vh, 177.78vw);
  margin: auto;
  overflow: hidden;
  background: var(--navy);
  box-shadow: 0 0 80px #000b;
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
}
.screen.is-active {
  display: flex;
}

/* Home: one clear decision to start the campaign. */
.home-screen {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: max(28px, env(safe-area-inset-top)) 8%
    max(24px, env(safe-area-inset-bottom));
  color: #fff;
  text-align: center;
  isolation: isolate;
  background:
    radial-gradient(circle at 82% 18%, #5268ff66 0 12%, transparent 35%),
    radial-gradient(circle at 4% 88%, #2ed7b944 0 8%, transparent 32%),
    linear-gradient(155deg, #172653 0%, #0e1733 65%, #0a1024 100%);
}

.home-screen::before,
.home-screen::after {
  content: "";
  position: absolute;
  z-index: -1;
  width: 54%;
  aspect-ratio: 1;
  border: 1px solid #ffffff12;
  border-radius: 32%;
  transform: rotate(18deg);
}
.home-screen::before {
  top: -12%;
  right: -18%;
}
.home-screen::after {
  bottom: -20%;
  left: -24%;
  transform: rotate(-20deg);
}

.brand-mark {
  width: clamp(78px, 21vw, 124px);
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(3, 17%);
  place-content: center;
  gap: 7%;
  margin-bottom: 6%;
  background: url("assets/ui/tile-selected.webp") center/100% 100% no-repeat;
  filter: drop-shadow(0 16px 22px #02071888);
}
.brand-mark i {
  aspect-ratio: 1;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 5px #2341a0;
}

h1 {
  margin: 0;
  line-height: 1;
}
h1 span {
  display: block;
  font-size: clamp(40px, 10.5vw, 67px);
  font-weight: 900;
  letter-spacing: -0.045em;
}
h1 small {
  display: block;
  margin-top: 12px;
  color: #72e7cf;
  font:
    900 clamp(11px, 2.8vw, 16px)/1 "Nunito",
    sans-serif;
  letter-spacing: 0.28em;
}
.tagline {
  max-width: 80%;
  margin: 5% 0 11%;
  color: #bfc9e1;
  font-size: clamp(15px, 3.8vw, 22px);
  font-weight: 700;
  line-height: 1.35;
}
.home-actions {
  width: 88%;
  display: grid;
  justify-items: center;
}

.asset-button {
  border: 0;
  cursor: pointer;
  background-color: transparent;
  background-repeat: no-repeat;
  background-position: center;
  font-weight: 900;
  transition:
    transform 0.14s ease,
    filter 0.14s ease,
    opacity 0.14s ease;
}
.asset-button:active {
  transform: translateY(3px) scale(0.985);
}
.asset-button:focus-visible,
.word-tile:focus-visible,
.text-action:focus-visible {
  outline: 3px solid #69efd5;
  outline-offset: 2px;
}

.primary-button {
  width: 100%;
  min-height: clamp(70px, 17vw, 102px);
  padding: 0 14%;
  color: #fff;
  background-image: url("assets/ui/button-primary.webp");
  background-size: 100% 100%;
  font-size: clamp(21px, 5.4vw, 34px);
  letter-spacing: 0.06em;
  text-shadow: 0 2px 5px #1d35a0;
}
.streak-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 7%;
  color: #9ba8c7;
  font-size: clamp(13px, 3.3vw, 19px);
  font-weight: 800;
}
.streak-badge strong {
  display: grid;
  place-items: center;
  min-width: 32px;
  height: 32px;
  padding: 0 9px;
  border-radius: 99px;
  background: #24335f;
  color: #71e7d0;
}

.icon-button {
  width: clamp(48px, 12vw, 72px);
  aspect-ratio: 1;
  background-size: contain;
}
.sound-button {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  right: 4%;
  background-image: url("assets/ui/icon-sound.webp");
}
.sound-button.is-muted {
  filter: grayscale(1);
  opacity: 0.55;
}

/* Play: soft sky so the colorful tiles stay the focus. */
.play-screen {
  flex-direction: column;
  isolation: isolate;
  overflow: hidden;
  padding: max(14px, env(safe-area-inset-top)) 4.5%
    max(12px, env(safe-area-inset-bottom));
  color: var(--ink);
  background:
    radial-gradient(120% 55% at 50% -8%, #ffffffd9 0%, transparent 58%),
    radial-gradient(ellipse 80% 50% at 8% 0%, #c9dcff 0%, transparent 62%),
    radial-gradient(ellipse 70% 42% at 100% 12%, #ffd4e6a6 0%, transparent 58%),
    radial-gradient(ellipse 75% 48% at 0% 100%, #b6f3e2 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 100% 100%, #ffe7b8a8 0%, transparent 55%),
    linear-gradient(168deg, #dce9ff 0%, #eef4ff 38%, #f7fbff 58%, #e8faf4 100%);
}
.play-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: radial-gradient(circle, #4b5cff16 1.15px, transparent 1.35px);
  background-size: 20px 20px;
  -webkit-mask-image: radial-gradient(
    ellipse 78% 68% at 50% 42%,
    #000 18%,
    transparent 76%
  );
  mask-image: radial-gradient(
    ellipse 78% 68% at 50% 42%,
    #000 18%,
    transparent 76%
  );
}
.play-screen::after {
  content: "";
  position: absolute;
  z-index: 0;
  pointer-events: none;
  width: 118%;
  aspect-ratio: 1;
  left: -9%;
  top: 22%;
  border: 1.5px solid #4d7ef518;
  border-radius: 36%;
  transform: rotate(16deg);
}
.play-backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.play-backdrop span {
  position: absolute;
  border-radius: 50%;
  filter: blur(36px);
  opacity: 0.42;
  animation: playBlobDrift 18s ease-in-out infinite alternate;
}
.play-backdrop span:nth-child(1) {
  width: 48%;
  aspect-ratio: 1;
  top: -12%;
  left: -18%;
  background: #7eb6ff;
}
.play-backdrop span:nth-child(2) {
  width: 40%;
  aspect-ratio: 1;
  top: 6%;
  right: -16%;
  background: #ff9eb8;
  animation-delay: -5s;
}
.play-backdrop span:nth-child(3) {
  width: 44%;
  aspect-ratio: 1;
  bottom: 4%;
  left: -16%;
  background: #6eefc4;
  animation-delay: -9s;
}
.play-backdrop span:nth-child(4) {
  width: 38%;
  aspect-ratio: 1;
  bottom: -10%;
  right: -14%;
  background: #ffd56a;
  animation-delay: -2s;
}
@keyframes playBlobDrift {
  from {
    transform: translate(0, 0) scale(1);
  }
  to {
    transform: translate(6%, -5%) scale(1.08);
  }
}
.level-intro {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 8;
  place-items: center;
  padding: 7%;
  background: #0d1a38a8;
  backdrop-filter: blur(8px);
}
.level-intro.is-open {
  display: grid;
}
.level-intro-card {
  width: min(100%, 340px);
  padding: 26px 22px 22px;
  border-radius: 28px;
  text-align: center;
  background: linear-gradient(180deg, #ffffff 0%, #f4f7ff 100%);
  box-shadow: 0 18px 40px #0b163866;
}
.level-intro-kicker {
  margin: 0 0 6px;
  color: #4159e8;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.level-intro-card h2 {
  margin: 0 0 16px;
  color: #17213d;
  font-size: clamp(26px, 6.5vw, 32px);
}
.level-intro-steps {
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
  text-align: left;
}
.level-intro-steps li {
  position: relative;
  margin: 0 0 10px;
  padding: 10px 12px 10px 42px;
  border-radius: 14px;
  color: #334168;
  background: #eef2ff;
  font-size: 14px;
  font-weight: 800;
}
.level-intro-steps li::before {
  position: absolute;
  left: 12px;
  top: 50%;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(180deg, #7eb6ff 0%, #4d7ef5 100%);
  font-size: 12px;
  transform: translateY(-50%);
}
.level-intro-steps li:nth-child(1)::before { content: "1"; }
.level-intro-steps li:nth-child(2)::before { content: "2"; }
.level-intro-steps li:nth-child(3)::before { content: "3"; }
.level-intro-samples {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-bottom: 8px;
}
.level-intro-samples span {
  padding: 6px 10px;
  border-radius: 999px;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}
.level-intro-samples span:nth-child(1) { background: #4d7ef5; }
.level-intro-samples span:nth-child(2) { background: #ff5d86; }
.level-intro-samples span:nth-child(3) { background: #2ad49a; }
.level-intro-samples span:nth-child(4) { background: #f5b431; }
.level-intro-note {
  margin: 0 0 16px;
  color: #6b7590;
  font-size: 13px;
  font-weight: 800;
}
.tutor-hand {
  position: absolute;
  z-index: 7;
  width: 78px;
  height: 96px;
  margin: 0;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translate(-6px, 2px);
}
.tutor-hand.is-on {
  opacity: 1;
  visibility: visible;
  animation: tutorTap 1.05s ease-in-out infinite;
}
.tutor-hand.is-left .tutor-hand-icon,
.tutor-hand.is-left .tutor-ripple {
  transform: scaleX(-1);
  transform-origin: 14px 12px;
}
.tutor-hand.is-left .tutor-bubble {
  left: auto;
  right: 8px;
  transform: translate(0, -100%);
}
.tutor-hand.is-left .tutor-bubble::after {
  left: auto;
  right: 22%;
}
.tutor-hand-icon {
  position: relative;
  z-index: 1;
  display: block;
  width: 78px;
  height: 96px;
  filter: drop-shadow(0 8px 10px #0b163866);
}
.tutor-ripple {
  position: absolute;
  left: 10px;
  top: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #4d7ef555;
  box-shadow: 0 0 0 8px #4d7ef522;
  animation: tutorRipple 1.05s ease-out infinite;
}
.tutor-bubble {
  position: absolute;
  left: 50%;
  top: -6px;
  min-width: max-content;
  margin: 0;
  padding: 6px 10px;
  border-radius: 999px;
  color: #fff;
  background: #17213d;
  box-shadow: 0 6px 14px #0b16384d;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.01em;
  transform: translate(-30%, -100%);
  white-space: nowrap;
}
.tutor-bubble::after {
  content: "";
  position: absolute;
  left: 28%;
  bottom: -5px;
  width: 10px;
  height: 10px;
  background: #17213d;
  transform: rotate(45deg);
}
.word-tile.is-tutor:not(.is-selected) {
  animation: tutorGlow 1.05s ease-in-out infinite;
  box-shadow: 0 0 0 3px #fff, 0 0 0 6px #4d7ef5, 0 8px 16px #27385f33;
}
#submitButton.submit-button.is-tutor:not(:disabled) {
  animation: tutorGlow 1.05s ease-in-out infinite;
}
@keyframes tutorTap {
  0%,
  100% {
    transform: translate(-4px, 4px) scale(1);
  }
  42% {
    transform: translate(-10px, -8px) scale(1.05);
  }
  58% {
    transform: translate(-2px, 6px) scale(0.94);
  }
}
@keyframes tutorRipple {
  0% {
    opacity: 0.7;
    transform: scale(0.6);
  }
  70%,
  100% {
    opacity: 0;
    transform: scale(2.1);
  }
}
@keyframes tutorGlow {
  0%,
  100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.12);
  }
}
.top-bar {
  position: relative;
  z-index: 2;
  height: 12%;
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--ink);
}
.back-button {
  position: static;
  background-image: url("assets/ui/icon-back.webp");
  background-size: 76%;
}
.level-title {
  min-width: 36%;
  text-align: center;
}
.level-title small,
.level-title strong {
  display: block;
}
.level-title small {
  color: #4b5cff;
  font-size: clamp(10px, 2.5vw, 14px);
  letter-spacing: 0.18em;
}
.level-title strong {
  margin-top: 1px;
  font-size: clamp(20px, 5vw, 30px);
}
.coin-hud {
  min-width: 92px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  padding: 0 12px 0 5px;
  border-radius: 999px;
  background: linear-gradient(180deg, #7a4528 0%, #5a2e18 42%, #3f1d10 100%);
  box-shadow:
    inset 0 3px 4px #1a0b08aa,
    inset 0 -1px 0 #a56a4488;
}
.coin-icon {
  position: relative;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 50%;
  background: radial-gradient(
    circle at 34% 30%,
    #fff3a8,
    #ffd24a 38%,
    #e8a31a 72%,
    #c47a0e 100%
  );
  box-shadow:
    inset 0 2px 0 #fff8c6,
    inset 0 -2px 0 #b56d0c,
    0 0 0 2px #2a140c;
  transform: rotate(-18deg);
}
.coin-icon::after {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  border: 2px solid #f0c44dcc;
}
.coin-hud strong {
  color: #fff;
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 0.02em;
  -webkit-text-stroke: 3px #2a140c;
  paint-order: stroke fill;
  text-shadow: none;
}
.coin-hud.is-catching {
  animation: coinCatch 0.22s ease;
}
.flying-coin {
  position: absolute;
  z-index: 40;
  width: 22px;
  height: 22px;
  margin: 0;
  pointer-events: none;
  border-radius: 50%;
  background: radial-gradient(
    circle at 34% 30%,
    #fff3a8,
    #ffd24a 38%,
    #e8a31a 72%,
    #c47a0e 100%
  );
  box-shadow:
    inset 0 2px 0 #fff8c6,
    inset 0 -2px 0 #b56d0c,
    0 0 0 2px #2a140c;
  animation: coinFly 0.72s cubic-bezier(0.2, 0.85, 0.25, 1) forwards;
}
@keyframes coinFly {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.35);
  }
  16% {
    opacity: 1;
    transform: translate(calc(-50% + var(--sx)), calc(-50% + var(--sy)))
      scale(1.15) rotate(-12deg);
  }
  100% {
    opacity: 0.9;
    transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy)))
      scale(0.4) rotate(18deg);
  }
}
@keyframes coinCatch {
  50% {
    transform: scale(1.1);
  }
}

.play-area {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.solved-groups {
  width: 100%;
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}
.solved-groups:empty {
  display: none;
  margin: 0;
}
.solved-card {
  min-height: 51px;
  display: grid;
  place-items: center;
  padding: 5px 12px;
  border-radius: 15px;
  color: #fff;
  text-align: center;
  box-shadow: 0 5px 12px #27335c22;
}
.solved-card.is-new {
  animation: pop 0.28s ease;
}
.solved-card strong {
  font-size: clamp(13px, 3.4vw, 20px);
  letter-spacing: 0.06em;
}
.solved-card small {
  font-size: clamp(9px, 2.4vw, 14px);
  opacity: 0.92;
}

.word-grid {
  width: 100%;
  margin-top: auto;
  margin-bottom: auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(8px, 2vw, 12px) clamp(6px, 1.6vw, 10px);
}
.word-tile {
  aspect-ratio: 1.4 / 1;
  display: grid;
  place-items: center;
  border: 0;
  padding: 8% 6%;
  overflow: hidden;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(180deg, #7eb6ff 0%, #4d7ef5 52%, #3b63e8 100%);
  font:
    900 clamp(10px, 2.8vw, 16px)/1.12 "Nunito",
    sans-serif;
  overflow-wrap: anywhere;
  cursor: pointer;
  text-shadow: 0 1px 0 #1d4cb888;
  transition:
    transform 0.14s ease,
    filter 0.14s ease,
    box-shadow 0.14s ease;
}
.word-tile:nth-child(8n + 1) {
  background: linear-gradient(180deg, #7eb6ff 0%, #4d7ef5 52%, #3b63e8 100%);
}
.word-tile:nth-child(8n + 2) {
  background: linear-gradient(180deg, #ff9eb8 0%, #ff5d86 52%, #e63d6b 100%);
  text-shadow: 0 1px 0 #b01d4888;
}
.word-tile:nth-child(8n + 3) {
  background: linear-gradient(180deg, #7aefc4 0%, #2ad49a 52%, #12b07c 100%);
  text-shadow: 0 1px 0 #0a7a5488;
}
.word-tile:nth-child(8n + 4) {
  background: linear-gradient(180deg, #ffd56a 0%, #f5b431 52%, #e09212 100%);
  text-shadow: 0 1px 0 #a86a0888;
}
.word-tile:nth-child(8n + 5) {
  background: linear-gradient(180deg, #c9a4ff 0%, #9b6bff 52%, #7a48e8 100%);
  text-shadow: 0 1px 0 #4c28a888;
}
.word-tile:nth-child(8n + 6) {
  background: linear-gradient(180deg, #7ae4ef 0%, #2ec4d4 52%, #1498b0 100%);
  text-shadow: 0 1px 0 #0a6a7a88;
}
.word-tile:nth-child(8n + 7) {
  background: linear-gradient(180deg, #ffb07a 0%, #ff7a3a 52%, #e85a18 100%);
  text-shadow: 0 1px 0 #b03a0a88;
}
.word-tile:nth-child(8n + 8) {
  background: linear-gradient(180deg, #f7a4e4 0%, #e45dc8 52%, #c73aac 100%);
  text-shadow: 0 1px 0 #8a187888;
}
.word-tile.is-selected {
  color: #fff;
  transform: translateY(-3px) scale(1.03);
  box-shadow:
    0 0 0 3px #fff,
    0 6px 14px #27385f33;
  filter: brightness(1.08);
}
.word-tile.is-hint {
  animation: glow 0.65s ease 2;
}
.feedback {
  width: 100%;
  height: 28px;
  margin: 0;
  text-align: center;
  color: #4b5cff;
  font-size: clamp(14px, 3.6vw, 20px);
  font-weight: 900;
}
.feedback.is-pop {
  animation: feedbackPop 0.35s cubic-bezier(0.22, 1.4, 0.36, 1);
}

.action-bar {
  position: relative;
  z-index: 2;
  height: 13%;
  min-height: 72px;
  display: grid;
  grid-template-columns: 56px 1fr 56px;
  gap: 3%;
  align-items: center;
  padding-top: 2px;
  padding-bottom: 16px;
}
#submitButton.submit-button {
  width: 100%;
  min-height: 48px;
  padding: 0 20px;
  border-radius: 999px;
  color: #fff;
  background-color: #4d7ef5;
  background-image: linear-gradient(180deg, #7eb6ff 0%, #4d7ef5 55%, #3b63e8 100%);
  box-shadow: 0 4px 0 #2a48c4;
  font-size: 18px;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 0 #1d4cb888;
  -webkit-text-stroke: 0;
}
#submitButton.submit-button:disabled {
  color: #fff;
  background-color: #c5cedd;
  background-image: linear-gradient(180deg, #dbe2ee 0%, #b7c2d4 100%);
  box-shadow: 0 3px 0 #8e9bb0;
  opacity: 1;
  filter: none;
  cursor: default;
  transform: none;
}
.round-action {
  position: relative;
  width: 42px;
  height: 42px;
  max-height: 42px;
  aspect-ratio: 1;
  justify-self: center;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 70%;
}
.round-action span {
  position: absolute;
  left: 50%;
  bottom: -15px;
  transform: translateX(-50%);
  color: #58627a;
  font-size: 11px;
  font-weight: 800;
  text-shadow: none;
  white-space: nowrap;
}
.hint-button {
  background-image: url("assets/ui/icon-hint.webp");
  background-size: 54%;
}
.hint-button.is-used-up,
.hint-button:disabled {
  opacity: 0.35;
  filter: grayscale(0.7);
  pointer-events: none;
}
.shuffle-button {
  background-image: url("assets/ui/icon-shuffle.webp");
  background-size: 86%;
}

.modal {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 10;
  place-items: center;
  padding: 7%;
  background: #0d1a38a8;
  backdrop-filter: blur(8px);
}
.modal.is-open {
  display: grid;
}
.modal-card {
  position: relative;
  width: min(100%, 340px);
  min-height: 0;
  padding: 28px 22px 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: var(--ink);
  text-align: center;
  background: linear-gradient(180deg, #ffffff 0%, #f4f7ff 100%);
  border-radius: 28px;
  box-shadow: 0 18px 40px #0b163866;
}
.result-burst {
  position: absolute;
  inset: -20% -10% auto;
  height: 58%;
  pointer-events: none;
  background:
    radial-gradient(circle at 18% 40%, #7eb6ff88 0 8%, transparent 28%),
    radial-gradient(circle at 82% 30%, #ff9eb888 0 8%, transparent 26%),
    radial-gradient(circle at 50% 8%, #ffd56a77 0 10%, transparent 30%),
    radial-gradient(circle at 70% 70%, #c9a4ff66 0 8%, transparent 24%);
}
.result-icon {
  position: relative;
  z-index: 1;
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(180deg, #5ee0a8 0%, #20b981 100%);
  font:
    900 34px/1 "Nunito",
    sans-serif;
  box-shadow:
    0 8px 0 #148a5c,
    0 12px 20px #20b98155;
}
.modal.is-lose .result-icon {
  background: linear-gradient(180deg, #ff8a9a 0%, #ff6174 100%);
  box-shadow:
    0 8px 0 #c73a4e,
    0 12px 20px #ff617455;
}
.modal h2 {
  position: relative;
  z-index: 1;
  margin: 16px 0 6px;
  color: #17213d;
  font-size: clamp(28px, 7vw, 36px);
  line-height: 1;
}
.modal p {
  position: relative;
  z-index: 1;
  margin: 0 0 16px;
  color: #6b7590;
  font-size: clamp(14px, 3.5vw, 16px);
  font-weight: 800;
}
.result-reward {
  display: none;
  align-items: center;
  gap: 8px;
  margin: -4px 0 18px;
  padding: 6px 14px 6px 8px;
  border-radius: 999px;
  background: linear-gradient(180deg, #7a4528 0%, #5a2e18 42%, #3f1d10 100%);
}
.modal.is-win .result-reward {
  display: inline-flex;
}
.result-reward .coin-icon {
  width: 24px;
  height: 24px;
}
.result-reward strong {
  color: #fff;
  font-size: 16px;
  -webkit-text-stroke: 3px #2a140c;
  paint-order: stroke fill;
}
.result-next {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(180deg, #7eb6ff 0%, #4d7ef5 52%, #3b63e8 100%);
  font:
    900 18px/1 "Nunito",
    sans-serif;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 0 #1d4cb888;
}
.result-next:active {
  transform: translateY(2px);
}
.result-again {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 44px;
  margin-top: 8px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  color: #3b63e8;
  background: #e8eeff;
  font:
    900 15px/1 "Nunito",
    sans-serif;
  cursor: pointer;
}
.result-again:active {
  transform: translateY(1px);
}

@keyframes pop {
  from {
    opacity: 0;
    transform: scale(0.88);
  }
  70% {
    transform: scale(1.025);
  }
}
@keyframes feedbackPop {
  from {
    opacity: 0;
    transform: scale(0.7);
  }
  70% {
    transform: scale(1.12);
  }
}
@keyframes glow {
  50% {
    filter: drop-shadow(0 0 13px #52e4c4);
    transform: translateY(-5px);
  }
}
@media (max-height: 650px) {
  .brand-mark {
    margin-bottom: 3%;
  }
  .tagline {
    margin: 3% 0 6%;
  }
  .action-bar {
    height: 13%;
  }
}

/* Bright puzzle-first home redesign. */
.home-screen {
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 8%, #ffffff 0 7%, transparent 28%),
    radial-gradient(circle at 92% 78%, #77ead14d 0 8%, transparent 30%),
    linear-gradient(150deg, #edf4ff 0%, #ffffff 47%, #ecfbf7 100%);
}
.home-screen::before {
  top: -15%;
  right: -20%;
  border-color: #5268ff1f;
}
.home-screen::after {
  bottom: -19%;
  left: -22%;
  border-color: #21b99824;
}
.home-screen .sound-button {
  filter: drop-shadow(0 5px 9px #18306a33);
}
.home-screen .brand-mark {
  width: clamp(68px, 18vw, 104px);
  margin-bottom: 3%;
  filter: drop-shadow(0 10px 13px #2d48ae2b);
}
.home-screen h1 {
  color: #17213d;
}
.home-screen h1 span {
  font-size: clamp(34px, 8.8vw, 56px);
  line-height: 0.95;
  letter-spacing: -0.055em;
}
.home-screen h1 small {
  color: #4159e8;
  letter-spacing: 0.14em;
}
.home-screen .tagline {
  margin: 4% 0 7%;
  color: #69748c;
}
.home-screen .streak-badge {
  color: #69748c;
  margin-top: 5%;
}
.home-screen .streak-badge strong {
  background: #e3e8ff;
  color: #4054df;
}
.floating-words {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.floating-words span {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 13px;
  border-radius: 13px;
  background: #fff;
  color: #506079;
  font:
    900 clamp(9px, 2.4vw, 13px)/1 "Nunito",
    sans-serif;
  box-shadow: 0 8px 22px #26406416;
  opacity: 0.78;
}
.floating-words span::after {
  content: "✓";
  color: #ff5a6a;
  font-size: 1.15em;
  font-weight: 900;
}
.home-screen.is-active::before {
  animation: homeRingDrift 22s linear infinite;
}
.home-screen.is-active::after {
  animation: homeRingDriftReverse 26s linear infinite;
}
.home-screen.is-active .sound-button {
  animation: homeEnter 0.55s cubic-bezier(0.22, 1.35, 0.36, 1) both;
}
.home-screen.is-active .brand-mark {
  animation:
    homeEnter 0.7s cubic-bezier(0.22, 1.35, 0.36, 1) both,
    homeLogoFloat 3.8s ease-in-out 0.7s infinite;
}
.home-screen.is-active .brand-mark i {
  animation: homeDotBounce 1.35s ease-in-out infinite;
}
.home-screen.is-active .brand-mark i:nth-child(2) {
  animation-delay: 0.16s;
}
.home-screen.is-active .brand-mark i:nth-child(3) {
  animation-delay: 0.32s;
}
.home-screen.is-active h1 {
  animation: homeEnter 0.7s cubic-bezier(0.22, 1.35, 0.36, 1) 0.08s both;
}
.home-screen.is-active .tagline {
  animation: homeEnter 0.7s cubic-bezier(0.22, 1.35, 0.36, 1) 0.16s both;
}
.home-screen.is-active .home-actions {
  animation: homeEnter 0.7s cubic-bezier(0.22, 1.35, 0.36, 1) 0.24s both;
}
.home-screen.is-active .streak-badge {
  animation: homeEnter 0.7s cubic-bezier(0.22, 1.35, 0.36, 1) 0.32s both;
}
.home-screen.is-active .streak-badge strong {
  animation: homeStreakPop 2.8s ease-in-out 0.9s infinite;
}

.floating-words span:nth-child(1) {
  top: 12%;
  left: -3%;
  color: #4860e9;
  animation: homeChip1 5.4s ease-in-out infinite;
}
.floating-words span:nth-child(2) {
  top: 23%;
  right: -5%;
  color: #d99617;
  animation: homeChip2 6.1s ease-in-out 0.4s infinite;
}
.floating-words span:nth-child(3) {
  bottom: 21%;
  left: -2%;
  color: #a155dc;
  animation: homeChip3 5.7s ease-in-out 0.8s infinite;
}
.floating-words span:nth-child(4) {
  bottom: 9%;
  right: -4%;
  color: #17a486;
  background: #e7faf3;
  animation: homeChip4 6.4s ease-in-out 0.2s infinite;
}
.floating-words span:nth-child(5) {
  top: 41%;
  left: -6%;
  color: #e25d7a;
  animation: homeChip5 5.9s ease-in-out 0.6s infinite;
}
.floating-words span:nth-child(6) {
  top: 62%;
  right: -7%;
  color: #4860e9;
  background: #eef2ff;
  animation: homeChip6 6.6s ease-in-out 1s infinite;
}

.home-screen .home-actions {
  width: auto;
}
.home-screen #levelsButton {
  position: relative;
  display: grid;
  place-items: center;
  width: clamp(132px, 38vw, 168px);
  min-height: clamp(48px, 11.5vw, 56px);
  padding: 0 18px;
  overflow: hidden;
  color: #fff;
  background:
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.5) 0%,
      rgba(255, 255, 255, 0.14) 26%,
      rgba(255, 255, 255, 0) 48%
    ),
    linear-gradient(180deg, #6aa8ff 0%, #3d7ff4 52%, #2a62e6 100%);
  border-radius: 16px;
  box-shadow:
    0 1px 0 #ffffffaa inset,
    0 -4px 8px #1d4ec040 inset,
    0 5px 0 #1e4cb8,
    0 10px 16px #2a4fb85c;
  font-size: clamp(16px, 4vw, 20px);
  letter-spacing: 0.08em;
  line-height: 1;
  white-space: nowrap;
  text-shadow: 0 2px 6px #163ea888;
}
.home-screen.is-active #levelsButton {
  animation: homePlayPulse 2.4s ease-in-out 0.4s infinite;
}
.home-screen.is-active #levelsButton::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    110deg,
    transparent 36%,
    #ffffff55 50%,
    transparent 64%
  );
  transform: translateX(-130%);
  animation: homeShine 3.4s ease-in-out 1.4s infinite;
}
.home-screen.is-active #levelsButton:active {
  animation: none;
}
.home-screen .utility-button {
  width: 84%;
  min-height: clamp(49px, 11vw, 66px);
  background-image: url("assets/ui/button-home-secondary.webp");
  background-size: 100% 100%;
  font-size: clamp(13px, 3.4vw, 20px);
  color: #27334d;
}

/* Campaign shell */
.campaign-screen {
  --node-size: clamp(48px, 12.4vw, 56px);
  --node-current: clamp(62px, 16.2vw, 70px);
  flex-direction: column;
  padding: 0;
  color: var(--ink);
  background: linear-gradient(180deg, #d7e8ff 0%, #e9f7ff 40%, #e6fbf3 100%);
  user-select: none;
}

/* Header */
.campaign-header {
  position: absolute;
  z-index: 10;
  top: max(10px, env(safe-area-inset-top));
  left: 4%;
  right: 4%;
  height: 52px;
  min-height: 52px;
  display: grid;
  grid-template-columns: 52px 1fr 52px;
  align-items: center;
  text-align: center;
  pointer-events: none;
}
.campaign-heading h2 {
  display: inline-block;
  margin: 0;
  padding: 7px 20px 8px;
  border-radius: 999px;
  color: #1a2b58;
  font-size: clamp(20px, 5.4vw, 26px);
  line-height: 1;
  letter-spacing: -0.03em;
  background: #ffffffea;
  box-shadow: none;
  backdrop-filter: blur(14px);
}
.campaign-back,
.campaign-heading {
  pointer-events: auto;
}
.campaign-back {
  width: 52px;
  height: 52px;
  padding: 0;
  border-radius: 50%;
  background-color: transparent;
  background-image: url("assets/ui/icon-back.webp");
  background-size: contain;
  box-shadow: none;
  touch-action: manipulation;
  filter: none;
}
.campaign-back:active {
  transform: scale(0.94);
  filter: none;
}
.campaign-back:focus-visible,
.difficulty-tab:focus-visible,
.level-option:focus-visible,
.map-chest:focus-visible,
.reward-ok:focus-visible {
  outline: 3px solid #3ce0c8;
  outline-offset: 3px;
}

/* Difficulty tabs */
.difficulty-tabs {
  position: absolute;
  z-index: 10;
  top: calc(max(10px, env(safe-area-inset-top)) + 56px);
  left: 12%;
  right: 12%;
  height: 40px;
  min-height: 40px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 4px;
  border-radius: 999px;
  background: #ffffffd6;
  box-shadow: none;
  backdrop-filter: blur(16px);
}
.difficulty-indicator {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc((100% - 8px) / 3);
  border-radius: 999px;
  background: linear-gradient(180deg, #7eb0ff 0%, #4d7ef5 52%, #3b63e8 100%);
  box-shadow: none;
  transition: transform 0.32s cubic-bezier(0.22, 1.28, 0.36, 1);
}
.difficulty-tabs[data-active="medium"] .difficulty-indicator {
  transform: translateX(100%);
}
.difficulty-tabs[data-active="hard"] .difficulty-indicator {
  transform: translateX(200%);
}
.difficulty-tab {
  position: relative;
  z-index: 1;
  min-height: 32px;
  border: 0;
  background: transparent;
  color: #6d7890;
  font:
    900 clamp(12px, 3.1vw, 15px) / 1 "Nunito",
    sans-serif;
  cursor: pointer;
  touch-action: manipulation;
  transition:
    color 0.28s ease,
    transform 0.28s ease;
}
.difficulty-tab.is-active {
  color: #fff;
  text-shadow: 0 1px 0 #2a4cb888;
}
.difficulty-tab.is-bouncing {
  animation: tabPop 0.32s cubic-bezier(0.22, 1.45, 0.36, 1);
}

/* Map card */
.campaign-map-card {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  border-radius: 0;
  background:
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.62) 0%,
      rgba(255, 255, 255, 0.08) 18%,
      transparent 36%
    ),
    linear-gradient(180deg, #dbeaff 0%, #eff8ff 42%, #dcfbef 100%);
  box-shadow: none;
}
.campaign-map-card::before {
  content: "";
  position: absolute;
  z-index: 7;
  top: 0;
  left: 0;
  right: 0;
  height: 128px;
  pointer-events: none;
  background: linear-gradient(180deg, #eaf4ffe8 0%, #eaf4ff00 100%);
}
.campaign-map-card.is-swapping .campaign-world {
  animation: mapSwap 0.28s ease;
}
.campaign-map-scroll {
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}
.campaign-map-scroll::-webkit-scrollbar {
  display: none;
}
.campaign-world {
  position: relative;
  width: 100%;
  overflow: hidden;
  background: linear-gradient(
    180deg,
    #d9d4ff 0%,
    #c5e8ff 12%,
    #8eefe4 24%,
    #c9f6ee 36%,
    #ffd4c0 48%,
    #ffe9d8 58%,
    #d5e4ff 68%,
    #eaf2ff 78%,
    #d5f8ea 90%,
    #b6f0d6 100%
  );
}
.campaign-world::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(90deg, #ffffff55, transparent 18% 82%, #ffffff55);
}

/* SVG trail */
.campaign-route {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}
.campaign-route path {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.route-shadow {
  stroke: #4d6a9730;
  stroke-width: 20;
  transform: translateY(6px);
}
.route-track {
  stroke: var(--campaign-path);
  stroke-width: 14;
}
.route-progress {
  stroke: url(#routeGradient);
  stroke-width: 14;
  filter: drop-shadow(0 0 6px #3ecfff88);
}

/* Decorations */
.map-decorations {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}
.biome-wash {
  position: absolute;
  left: -18%;
  width: 136%;
  border-radius: 46% 54% 48% 52%;
  filter: blur(6px);
  opacity: 0.72;
}
.biome-meadow {
  background: radial-gradient(ellipse at 50% 60%, #b8f5d48c, transparent 68%);
}
.biome-cloud {
  background: radial-gradient(ellipse at 40% 40%, #c9d8ff99, transparent 70%);
}
.biome-sunset {
  background: radial-gradient(ellipse at 60% 50%, #ffd2c091, transparent 70%);
}
.biome-lake {
  background: radial-gradient(ellipse at 45% 55%, #9af0ea8c, transparent 68%);
}
.biome-stars {
  background: radial-gradient(ellipse at 50% 40%, #d7c8ff8c, transparent 70%);
}
.world-label {
  position: absolute;
  z-index: 2;
  min-width: 132px;
  padding: 8px 14px 9px;
  border-radius: 16px;
  color: #334168;
  text-align: center;
  background: #ffffffd4;
  box-shadow: 0 8px 18px #334b7920;
  backdrop-filter: blur(8px);
  transform: translateX(-50%);
}
.world-label small {
  display: block;
  color: #566bed;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.18em;
}
.world-label strong {
  display: block;
  margin-top: 1px;
  font-size: 14px;
  letter-spacing: -0.02em;
}
.map-deco {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.map-cloud {
  width: 54px;
  height: 18px;
  border-radius: 20px;
  background: #ffffffd4;
  box-shadow:
    16px 5px 0 #ffffffd4,
    32px -1px 0 #ffffffd4;
  animation: cloudDrift 7s ease-in-out infinite;
}
.map-cloud.cloud-2 {
  transform: translate(-50%, -50%) scale(0.78);
  animation-delay: -2s;
}
.map-cloud.cloud-3 {
  transform: translate(-50%, -50%) scale(1.12);
  opacity: 0.8;
}
.map-hill {
  width: 120px;
  height: 64px;
  border-radius: 50% 50% 8px 8px;
  background: linear-gradient(180deg, #8ee6bf66, #5dcea055);
}
.map-hill.hill-2 {
  width: 88px;
  height: 48px;
  background: linear-gradient(180deg, #f7c39f66, #ef9d7c55);
}
.map-word {
  width: auto;
  height: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: 12px;
  background: #fff;
  color: #506079;
  font:
    900 11px/1 "Nunito",
    sans-serif;
  letter-spacing: 0.04em;
  box-shadow: 0 8px 18px #26406418;
  opacity: 0.86;
  white-space: nowrap;
}
.map-word::after {
  content: "✓";
  color: #ff5a6a;
  font-size: 1.05em;
  font-weight: 900;
}
.map-word.word-1 {
  color: #4860e9;
  transform: translate(-50%, -50%) rotate(-8deg);
}
.map-word.word-2 {
  color: #d99617;
  transform: translate(-50%, -50%) rotate(7deg);
}
.map-word.word-3 {
  color: #a155dc;
  background: #f6edff;
  transform: translate(-50%, -50%) rotate(6deg);
}
.map-word.word-4 {
  color: #17a486;
  background: #e7faf3;
  transform: translate(-50%, -50%) rotate(-7deg);
}
.map-rock {
  width: 22px;
  height: 16px;
  border-radius: 12px 10px 8px 11px;
  background: linear-gradient(180deg, #d8d3ea, #b7b0cc);
  box-shadow: 10px 4px 0 #c6bfd8;
}
.map-pond {
  width: 46px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(180deg, #8fe8ff, #4eb8e8);
  box-shadow:
    inset 0 2px 0 #e7fbff,
    0 4px 0 #3b97c488;
}
.map-pond::after {
  content: "";
  position: absolute;
  left: 8px;
  top: 5px;
  width: 14px;
  height: 5px;
  border-radius: 99px;
  background: #ffffff99;
}
.map-sparkle {
  width: 10px;
  height: 10px;
  background: #fff8c6;
  clip-path: polygon(
    50% 0,
    62% 38%,
    100% 50%,
    62% 62%,
    50% 100%,
    38% 62%,
    0 50%,
    38% 38%
  );
  filter: drop-shadow(0 0 4px #fff3a8);
  animation: sparkleTwinkle 1.8s ease-in-out infinite;
}
.map-flag {
  width: 6px;
  height: 28px;
  border-radius: 3px;
  background: #d7dee8;
  box-shadow: 8px -8px 0 0 #ff6b7d;
}

/* Treasure chests */
.map-chest {
  position: absolute;
  z-index: 3;
  width: 34px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 6px 6px 8px 8px;
  background: linear-gradient(180deg, #ffd56a, #e39428);
  box-shadow:
    inset 0 2px 0 #ffe9a8,
    0 4px 0 #b56d12,
    0 8px 12px #8a4e1233;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  cursor: pointer;
  animation: chestIdle 2.4s ease-in-out infinite;
}
.map-chest::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 9px;
  height: 3px;
  background: #c97a16;
}
.map-chest::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 13px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ffe9a8;
  box-shadow: inset 0 0 0 2px #d98418;
  transform: translateX(-50%);
}
.map-chest.is-locked {
  filter: grayscale(0.45) brightness(0.92);
  animation: none;
  cursor: default;
}
.map-chest.is-ready {
  box-shadow:
    inset 0 2px 0 #ffe9a8,
    0 4px 0 #b56d12,
    0 8px 12px #8a4e1233,
    0 0 14px #ffd56a99;
}
.map-chest.is-claimed {
  background: linear-gradient(180deg, #eee0b4, #c9a45a);
  animation: none;
}
.map-chest.is-opening {
  animation: chestPop 0.45s cubic-bezier(0.22, 1.45, 0.36, 1);
}
.map-chest.shake {
  animation: lockedShake 0.28s ease;
}

/* Level nodes */
.level-nodes {
  position: absolute;
  inset: 0;
  z-index: 4;
}
.level-option {
  position: absolute;
  width: var(--node-size);
  height: var(--node-size);
  display: grid;
  place-items: center;
  border: 0;
  padding: 0;
  border-radius: 50%;
  color: #5a6580;
  background: linear-gradient(180deg, #ffffff, #e8edf8);
  box-shadow:
    inset 0 2px 0 #fff,
    0 4px 0 #c7d1e7,
    0 10px 16px #3852822e;
  font:
    900 clamp(13px, 3.4vw, 18px) / 1 "Nunito",
    sans-serif;
  cursor: pointer;
  touch-action: manipulation;
  transform: translate(-50%, -50%);
  transition:
    transform 0.16s ease,
    filter 0.16s ease,
    width 0.2s ease,
    height 0.2s ease;
}
.node-core,
.node-number,
.node-lock {
  display: grid;
  place-items: center;
}
.node-shine {
  position: absolute;
  top: 7px;
  left: 10px;
  width: 38%;
  height: 22%;
  border-radius: 99px;
  background: #ffffffaa;
  pointer-events: none;
}
.node-lock {
  width: 13px;
  height: 11px;
  border-radius: 3px;
  background: #9aa3bb;
  box-shadow: 0 -7px 0 -3px #9aa3bb;
}

/* Node states */
.level-option.is-complete {
  color: #2f64d4;
  background: linear-gradient(180deg, #ffffff 0%, #e7f4ff 100%);
  box-shadow:
    inset 0 2px 0 #fff,
    0 0 0 3px #7ad6ff,
    0 4px 0 #4ea8de,
    0 10px 16px #3d9ad048,
    0 0 14px #5ad4ff55;
}
.level-option.is-current {
  z-index: 5;
  width: var(--node-current);
  height: var(--node-current);
  color: #fff;
  background: linear-gradient(180deg, #8ed4ff 0%, #3d7bff 46%, #3554e8 100%);
  box-shadow:
    inset 0 3px 0 #d8f0ff,
    0 5px 0 #1e3db8,
    0 0 0 6px #fff,
    0 0 0 8px #8fd4ff77,
    0 12px 24px #3d7bff55,
    0 0 28px #3ce0ff88;
  animation: currentFloat 2.2s ease-in-out infinite;
}
.level-option.is-current .node-number {
  font-size: 1.08em;
  text-shadow: 0 2px 0 #1e3db888;
}
.level-option.is-locked {
  width: calc(var(--node-size) * 0.88);
  height: calc(var(--node-size) * 0.88);
  color: transparent;
  background: linear-gradient(180deg, #f3f1f8, #d8d4e6);
  box-shadow:
    inset 0 2px 0 #fff,
    0 3px 0 #c5c0d4,
    0 7px 12px #6a649022;
  filter: saturate(0.65);
  cursor: not-allowed;
}
.level-option.is-milestone:not(.is-locked) {
  width: calc(var(--node-size) * 1.18);
  height: calc(var(--node-size) * 1.18);
}
.level-option.is-milestone.is-current {
  width: calc(var(--node-current) * 1.08);
  height: calc(var(--node-current) * 1.08);
}
.level-option.is-complete.is-current {
  color: #fff;
}
.level-option.is-pressed {
  animation: none;
  transform: translate(-50%, -50%) scale(0.9);
  filter: brightness(1.12);
}
.level-option.shake {
  animation: lockedShake 0.28s ease;
}
.level-option.is-unlocking {
  animation: nodeUnlock 0.45s cubic-bezier(0.22, 1.5, 0.36, 1);
}
.node-crown,
.node-star {
  position: absolute;
  left: 50%;
  pointer-events: none;
}
.node-crown {
  top: -15px;
  width: 22px;
  height: 13px;
  background: linear-gradient(180deg, #ffe27a, #f0b429);
  clip-path: polygon(
    0 100%,
    0 42%,
    22% 70%,
    50% 0,
    78% 70%,
    100% 42%,
    100% 100%
  );
  filter: drop-shadow(0 2px 2px #c9891244);
  transform: translateX(-50%);
}
.node-star {
  top: -14px;
  width: 12px;
  height: 12px;
  background: #ffe27a;
  clip-path: polygon(
    50% 0,
    62% 38%,
    100% 50%,
    62% 62%,
    50% 100%,
    38% 62%,
    0 50%,
    38% 38%
  );
  filter: drop-shadow(0 0 4px #ffe27a);
  transform: translateX(-50%);
}
.node-stars {
  position: absolute;
  top: calc(100% + 4px);
  left: 50%;
  display: flex;
  gap: 2px;
  transform: translateX(-50%);
  pointer-events: none;
}
.node-stars i {
  width: 8px;
  height: 8px;
  background: #d5dbe8;
  clip-path: polygon(
    50% 0,
    61% 35%,
    98% 35%,
    68% 57%,
    79% 91%,
    50% 70%,
    21% 91%,
    32% 57%,
    2% 35%,
    39% 35%
  );
}
.node-stars i.is-lit {
  background: linear-gradient(180deg, #ffe27a, #f5b42a);
  filter: drop-shadow(0 1px 1px #d39a1244);
}
.node-stars.is-arriving i.is-lit {
  animation: starIn 0.35s cubic-bezier(0.22, 1.5, 0.36, 1) both;
}
.node-stars.is-arriving i:nth-child(2) {
  animation-delay: 0.08s;
}
.node-stars.is-arriving i:nth-child(3) {
  animation-delay: 0.16s;
}
.node-ripple {
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 3px solid #fff;
  pointer-events: none;
  animation: rippleOut 0.38s ease-out forwards;
}
.locked-message {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 6;
  margin: 0;
  color: #e45466;
  text-align: center;
  font-size: clamp(12px, 3vw, 15px);
  font-weight: 900;
  text-shadow: 0 1px 0 #fff;
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}
.locked-message.is-visible {
  opacity: 1;
  transform: none;
}
.map-confetti {
  position: absolute;
  z-index: 6;
  width: 8px;
  height: 8px;
  pointer-events: none;
  transform: translate(-50%, -50%);
}
.map-confetti i {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: #4b5cff;
  animation: confettiBurst 0.8s ease-out forwards;
}
.map-confetti i:nth-child(2) {
  background: #35d8b0;
  --dx: 14px;
  --dy: -18px;
}
.map-confetti i:nth-child(3) {
  background: #ffd56a;
  --dx: -16px;
  --dy: -12px;
}
.map-confetti i:nth-child(4) {
  background: #ff6b7d;
  --dx: 18px;
  --dy: 8px;
}
.map-confetti i:nth-child(5) {
  background: #8b7cff;
  --dx: -12px;
  --dy: 14px;
}
.map-confetti i:nth-child(6) {
  background: #3ecfff;
  --dx: 6px;
  --dy: -22px;
}
.map-confetti i:nth-child(7) {
  background: #ff9ec4;
  --dx: -20px;
  --dy: 4px;
}
.map-confetti i:nth-child(8) {
  background: #7ad6ff;
  --dx: 12px;
  --dy: 16px;
}

/* Reward modal */
.reward-modal {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 12;
  place-items: center;
  padding: 10%;
  background: #14204499;
  backdrop-filter: blur(8px);
}
.reward-modal.is-open {
  display: grid;
}
.reward-card {
  position: relative;
  width: 100%;
  padding: 28px 22px 22px;
  display: grid;
  justify-items: center;
  border-radius: 28px;
  background: linear-gradient(180deg, #fff, #eef5ff);
  box-shadow: 0 18px 36px #10224a40;
  text-align: center;
  animation: campaignRise 0.35s cubic-bezier(0.22, 1.2, 0.36, 1);
}
.reward-chest-art {
  width: 64px;
  height: 52px;
  margin-bottom: 8px;
  border-radius: 10px 10px 14px 14px;
  background: linear-gradient(180deg, #ffd56a, #e39428);
  box-shadow:
    inset 0 3px 0 #ffe9a8,
    0 6px 0 #b56d12;
  animation: chestPop 0.5s cubic-bezier(0.22, 1.45, 0.36, 1);
}
.reward-card h3 {
  margin: 8px 0 4px;
  font-size: clamp(22px, 6vw, 28px);
}
.reward-card p {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: clamp(13px, 3.4vw, 16px);
  font-weight: 800;
}
.reward-ok {
  min-width: 150px;
  min-height: 48px;
  border: 0;
  border-radius: 16px;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(180deg, #6aa8ff 0%, #3d7ff4 52%, #2a62e6 100%);
  box-shadow:
    inset 0 1px 0 #ffffffaa,
    0 5px 0 #1e4cb8,
    0 10px 16px #2a4fb85c;
  font:
    900 16px/1 "Nunito",
    sans-serif;
}
.reward-ok:active {
  transform: translateY(3px);
}

/* Animations */
.campaign-screen.is-entering .campaign-header {
  animation: campaignDrop 0.45s ease both;
}
.campaign-screen.is-entering .difficulty-tabs {
  animation: campaignDrop 0.45s 0.08s ease both;
}
.campaign-screen.is-entering .campaign-map-card {
  animation: campaignRise 0.55s 0.12s ease both;
}
.campaign-screen.is-entering .route-progress {
  animation: none;
}
.campaign-screen.is-entering .level-option {
  animation: nodePop 0.38s cubic-bezier(0.22, 1.4, 0.36, 1) both;
}

@keyframes campaignDrop {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
}
@keyframes campaignRise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
}
@keyframes drawRoute {
  from {
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
  }
  to {
    stroke-dasharray: 1;
    stroke-dashoffset: 0;
  }
}
@keyframes currentFloat {
  50% {
    transform: translate(-50%, calc(-50% - 5px));
    filter: brightness(1.08);
  }
}
@keyframes lockedShake {
  25% {
    transform: translate(calc(-50% - 5px), -50%);
  }
  75% {
    transform: translate(calc(-50% + 5px), -50%);
  }
}
@keyframes nodePop {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.6);
  }
  70% {
    transform: translate(-50%, -50%) scale(1.08);
  }
}
@keyframes nodeUnlock {
  0% {
    transform: translate(-50%, -50%) scale(0.72);
  }
  70% {
    transform: translate(-50%, -50%) scale(1.12);
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
  }
}
@keyframes tabPop {
  50% {
    transform: scale(1.06);
  }
}
@keyframes cloudDrift {
  50% {
    transform: translate(calc(-50% + 8px), -50%);
  }
}
@keyframes sparkleTwinkle {
  50% {
    opacity: 0.35;
    transform: translate(-50%, -50%) scale(0.7) rotate(18deg);
  }
}
@keyframes chestIdle {
  50% {
    transform: translate(-50%, calc(-50% - 3px));
  }
}
@keyframes chestPop {
  0% {
    transform: translate(-50%, -50%) scale(0.86);
  }
  70% {
    transform: translate(-50%, -50%) scale(1.14);
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
  }
}
@keyframes starIn {
  from {
    opacity: 0;
    transform: scale(0.4);
  }
  70% {
    transform: scale(1.2);
  }
}
@keyframes rippleOut {
  from {
    transform: scale(0.7);
    opacity: 0.85;
  }
  to {
    transform: scale(1.28);
    opacity: 0;
  }
}
@keyframes confettiBurst {
  from {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }
  to {
    opacity: 0;
    transform: translate(var(--dx, -10px), var(--dy, -18px)) scale(0.6);
  }
}
@keyframes mapSwap {
  from {
    opacity: 0.45;
  }
}

@keyframes homeEnter {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.94);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
@keyframes homeLogoFloat {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}
@keyframes homeDotBounce {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }
  45% {
    transform: translateY(-3px) scale(1.18);
  }
}
@keyframes homePlayPulse {
  0%,
  100% {
    transform: translateY(0) scale(1);
    filter: brightness(1);
  }
  50% {
    transform: translateY(-3px) scale(1.035);
    filter: brightness(1.07);
  }
}
@keyframes homeShine {
  0%,
  58%,
  100% {
    transform: translateX(-130%);
  }
  78% {
    transform: translateX(130%);
  }
}
@keyframes homeStreakPop {
  0%,
  70%,
  100% {
    transform: scale(1);
  }
  78% {
    transform: scale(1.14);
  }
}
@keyframes homeRingDrift {
  from {
    transform: rotate(18deg);
  }
  to {
    transform: rotate(378deg);
  }
}
@keyframes homeRingDriftReverse {
  from {
    transform: rotate(-20deg);
  }
  to {
    transform: rotate(-380deg);
  }
}
@keyframes homeChip1 {
  0%,
  100% {
    transform: rotate(-10deg) translateY(0);
  }
  50% {
    transform: rotate(-4deg) translateY(-12px);
  }
}
@keyframes homeChip2 {
  0%,
  100% {
    transform: rotate(9deg) translateY(0);
  }
  50% {
    transform: rotate(14deg) translateY(-11px);
  }
}
@keyframes homeChip3 {
  0%,
  100% {
    transform: rotate(7deg) translateY(0);
  }
  50% {
    transform: rotate(2deg) translateY(-13px);
  }
}
@keyframes homeChip4 {
  0%,
  100% {
    transform: rotate(-8deg) translateY(0);
  }
  50% {
    transform: rotate(-13deg) translateY(-10px);
  }
}
@keyframes homeChip5 {
  0%,
  100% {
    transform: rotate(-12deg) translateY(0);
  }
  50% {
    transform: rotate(-6deg) translateY(-9px);
  }
}
@keyframes homeChip6 {
  0%,
  100% {
    transform: rotate(11deg) translateY(0);
  }
  50% {
    transform: rotate(6deg) translateY(-12px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
@media (max-width: 360px) {
  .campaign-back {
    width: 46px;
    height: 46px;
  }
  .campaign-header {
    grid-template-columns: 46px 1fr 46px;
  }
  .world-label {
    min-width: 118px;
    padding: 7px 10px;
  }
}
@media (max-height: 650px) {
  .home-screen h1 span {
    font-size: clamp(34px, 9vw, 54px);
  }
  .campaign-header {
    height: 46px;
    min-height: 46px;
  }
  .difficulty-tabs {
    top: calc(max(10px, env(safe-area-inset-top)) + 50px);
    height: 36px;
    min-height: 36px;
  }
}
