@layer reset, tokens, base, layout, components, fx, overlays, state;

@layer reset {
  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }

  html,
  body {
    margin: 0;
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
    touch-action: manipulation;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    text-rendering: optimizeLegibility;
  }

  img,
  svg,
  canvas {
    display: block;
    max-width: 100%;
  }

  button {
    font: inherit;
    color: inherit;
    background: none;
    border: 0;
    padding: 0;
    margin: 0;
    cursor: var(--cursor-hand, pointer);
    touch-action: manipulation;
  }

  input,
  textarea {
    font: inherit;
    color: inherit;
  }

  h1,
  h2,
  h3,
  h4,
  p {
    margin: 0;
  }

  [hidden] {
    display: none !important;
  }
}

@layer tokens {
  :root {
    --font-display: 'Lilita One', 'Fredoka', system-ui, sans-serif;
    --font-body: 'Fredoka', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --text: #fff8fc;
    --text-dim: rgba(255, 240, 250, 0.72);
    --gold-hi: #fff4c4;
    --gold: #ffd44a;
    --ink: #3b0d4a;
    --ink-2: #5a1a6e;
    --plum: #2a0845;
    --plum-2: #3d0f63;
    --plum-3: #561a86;
    --pink: #ff5fb5;
    --pink-deep: #d21f8c;
    --magenta: #b8338f;
    --cream: #fff6fb;
    --cream-2: #ffe3f1;
    --mint: #5ee06a;
    --sky: #5ec8ff;
    --sun: #ffcf3f;
    --coin: #ffc233;
    --gem: #5ff0ff;
    --heart: #ff3d5e;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
    --topbar-h: 58px;
    --nav-h: 74px;
    --ease-pop: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-in: cubic-bezier(0.55, 0, 1, 0.45);
  }
}

@layer base {
  body {
    background: #1b0533;
    color: var(--text);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 16px;
    line-height: 1.3;
    cursor: var(--cursor-arrow, default);
  }

  .noscript {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    font-size: 20px;
  }

  .num {
    font-variant-numeric: tabular-nums;
  }

  .ol {
    color: #fff;
    -webkit-text-stroke: 2px var(--ol, var(--ink));
    paint-order: stroke fill;
    text-shadow: 0 3px 0 var(--ol, var(--ink));
  }

  .ol-thin {
    color: #fff;
    -webkit-text-stroke: 1.2px var(--ol, var(--ink));
    paint-order: stroke fill;
    text-shadow: 0 2px 0 var(--ol, var(--ink));
  }

  .display {
    font-family: var(--font-display);
    font-weight: 400;
    letter-spacing: 0.02em;
  }
}

@layer components {
  .btn {
    --b-hi: #9cf05e;
    --b-mid: #54c81c;
    --b-lo: #2c9a0c;
    --b-edge: #1b6608;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4em;
    min-height: 50px;
    padding: 0 24px;
    border-radius: 18px;
    font-family: var(--font-display);
    font-size: 22px;
    line-height: 1;
    color: #fff;
    letter-spacing: 0.03em;
    white-space: nowrap;
    text-decoration: none;
    background: linear-gradient(180deg, var(--b-hi) 0%, var(--b-mid) 52%, var(--b-lo) 100%);
    border: 3px solid var(--b-edge);
    box-shadow:
      inset 0 3px 0 rgba(255, 255, 255, 0.45),
      inset 0 -5px 0 rgba(0, 0, 0, 0.16),
      0 5px 0 var(--b-edge),
      0 9px 16px rgba(20, 0, 40, 0.38);
    -webkit-text-stroke: 1.4px var(--b-edge);
    paint-order: stroke fill;
    text-shadow: 0 2px 0 var(--b-edge);
    transition: transform 0.09s ease, box-shadow 0.09s ease, filter 0.15s ease;
    isolation: isolate;
  }

  .btn::before {
    content: '';
    position: absolute;
    z-index: -1;
    left: 7%;
    right: 7%;
    top: 3px;
    height: 42%;
    border-radius: 14px 14px 40% 40% / 14px 14px 12px 12px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.05));
    pointer-events: none;
  }

  .btn:active,
  .btn.is-down {
    transform: translateY(4px);
    box-shadow:
      inset 0 3px 0 rgba(255, 255, 255, 0.35),
      inset 0 -3px 0 rgba(0, 0, 0, 0.16),
      0 1px 0 var(--b-edge),
      0 3px 8px rgba(20, 0, 40, 0.3);
  }

  .btn:disabled,
  .btn[aria-disabled='true'] {
    filter: grayscale(0.85) brightness(0.9);
    cursor: var(--cursor-arrow, default);
  }

  .btn:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 3px;
  }

  .btn--blue {
    --b-hi: #8fe0ff;
    --b-mid: #34a8f4;
    --b-lo: #1a70d4;
    --b-edge: #0f4a96;
  }

  .btn--gold {
    --b-hi: #fff08a;
    --b-mid: #ffc21a;
    --b-lo: #f08a00;
    --b-edge: #a44f00;
  }

  .btn--pink {
    --b-hi: #ffb3e0;
    --b-mid: #ff5fb5;
    --b-lo: #d61f8f;
    --b-edge: #8e0f5c;
  }

  .btn--red {
    --b-hi: #ffa0a0;
    --b-mid: #ff5454;
    --b-lo: #cf2020;
    --b-edge: #7e0d0d;
  }

  .btn--purple {
    --b-hi: #d6a6ff;
    --b-mid: #9b54f0;
    --b-lo: #6a22c4;
    --b-edge: #3f1080;
  }

  .btn--gem {
    --b-hi: #b6fbff;
    --b-mid: #45d9f0;
    --b-lo: #139bd0;
    --b-edge: #0b5f86;
  }

  .btn--small {
    min-height: 38px;
    padding: 0 14px;
    font-size: 17px;
    border-radius: 14px;
    border-width: 2px;
    -webkit-text-stroke-width: 1px;
  }

  .btn--wide {
    width: 100%;
  }

  .btn--big {
    min-height: 62px;
    font-size: 30px;
    border-radius: 22px;
    padding: 0 34px;
  }

  .btn__icon {
    width: 1.1em;
    height: 1.1em;
    flex: none;
    filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.25));
  }

  .round-btn {
    position: relative;
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 32%, #ffd6f0 0%, #ff78c4 38%, #c41c86 100%);
    border: 3px solid #7a0f53;
    box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.6), 0 4px 0 #7a0f53, 0 7px 12px rgba(0, 0, 0, 0.35);
    transition: transform 0.1s ease;
  }

  .round-btn svg {
    width: 58%;
    height: 58%;
    filter: drop-shadow(0 2px 0 rgba(90, 10, 60, 0.6));
  }

  .round-btn:active {
    transform: translateY(3px) scale(0.96);
  }

  .round-btn--blue {
    background: radial-gradient(circle at 50% 32%, #d8f4ff 0%, #5cc0ff 40%, #1668c8 100%);
    border-color: #0c3f82;
    box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.6), 0 4px 0 #0c3f82, 0 7px 12px rgba(0, 0, 0, 0.35);
  }

  .round-btn--gold {
    background: radial-gradient(circle at 50% 32%, #fff6c6 0%, #ffcf3f 42%, #d27a00 100%);
    border-color: #8a4700;
    box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.6), 0 4px 0 #8a4700, 0 7px 12px rgba(0, 0, 0, 0.35);
  }

  .close-btn {
    position: absolute;
    z-index: 5;
    top: -16px;
    right: -14px;
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 30%, #ffb3b3 0%, #ff4b4b 45%, #b81414 100%);
    border: 3px solid #fff;
    box-shadow: 0 0 0 3px #7a0a0a, 0 5px 10px rgba(0, 0, 0, 0.4);
    transition: transform 0.12s var(--ease-pop);
  }

  .close-btn svg {
    width: 52%;
    height: 52%;
  }

  .close-btn:active {
    transform: scale(0.9);
  }

  .ribbon {
    position: relative;
    display: inline-block;
    padding: 10px 34px 12px;
    font-family: var(--font-display);
    font-size: 28px;
    line-height: 1;
    color: #fff;
    letter-spacing: 0.03em;
    background: linear-gradient(180deg, #ff8fd0 0%, #ff4fae 45%, #d61e8c 100%);
    border: 3px solid #8e0f5c;
    border-radius: 14px;
    box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.45), 0 5px 0 #8e0f5c, 0 9px 14px rgba(40, 0, 30, 0.35);
    -webkit-text-stroke: 1.6px #8e0f5c;
    paint-order: stroke fill;
    text-shadow: 0 3px 0 #8e0f5c;
    white-space: nowrap;
  }

  .ribbon::before,
  .ribbon::after {
    content: '';
    position: absolute;
    z-index: -1;
    top: 14px;
    width: 34px;
    height: 100%;
    background: linear-gradient(180deg, #e0328f, #a8136a);
    border: 3px solid #8e0f5c;
  }

  .ribbon::before {
    left: -26px;
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 34% 50%);
    border-right: 0;
  }

  .ribbon::after {
    right: -26px;
    clip-path: polygon(0 0, 100% 0, 66% 50%, 100% 100%, 0 100%);
    border-left: 0;
  }

  .ribbon--blue {
    background: linear-gradient(180deg, #8fdcff 0%, #3ba9f5 45%, #1868cc 100%);
    border-color: #0c3f82;
    -webkit-text-stroke-color: #0c3f82;
    text-shadow: 0 3px 0 #0c3f82;
    box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.45), 0 5px 0 #0c3f82, 0 9px 14px rgba(0, 10, 40, 0.35);
  }

  .ribbon--blue::before,
  .ribbon--blue::after {
    background: linear-gradient(180deg, #2f8ee0, #145aa8);
    border-color: #0c3f82;
  }

  .ribbon--gold {
    background: linear-gradient(180deg, #fff09a 0%, #ffc526 45%, #e98700 100%);
    border-color: #8a4700;
    -webkit-text-stroke-color: #8a4700;
    text-shadow: 0 3px 0 #8a4700;
    box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.5), 0 5px 0 #8a4700, 0 9px 14px rgba(40, 20, 0, 0.35);
  }

  .ribbon--gold::before,
  .ribbon--gold::after {
    background: linear-gradient(180deg, #e8a41a, #b36400);
    border-color: #8a4700;
  }

  .pill {
    position: relative;
    display: inline-flex;
    align-items: center;
    height: 36px;
    padding: 0 10px 0 34px;
    border-radius: 99px;
    background: linear-gradient(180deg, rgba(40, 6, 70, 0.88), rgba(24, 2, 44, 0.92));
    border: 2px solid rgba(255, 255, 255, 0.28);
    box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.14), 0 4px 10px rgba(0, 0, 0, 0.35);
    font-family: var(--font-display);
    font-size: 18px;
    color: #fff;
    letter-spacing: 0.02em;
    white-space: nowrap;
  }

  .pill__icon {
    position: absolute;
    left: -8px;
    top: 50%;
    width: 40px;
    height: 40px;
    translate: 0 -50%;
    filter: drop-shadow(0 3px 2px rgba(0, 0, 0, 0.4));
  }

  .pill__plus {
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    margin-left: 8px;
    margin-right: -4px;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 30%, #b3ff8a, #3fb814 70%);
    border: 2px solid #1d6a06;
    color: #fff;
    font-size: 16px;
    line-height: 1;
    -webkit-text-stroke: 1px #1d6a06;
    paint-order: stroke fill;
  }

  .pill__sub {
    margin-left: 6px;
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 700;
    color: var(--text-dim);
  }

  .badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    display: grid;
    place-items: center;
    border-radius: 99px;
    background: radial-gradient(circle at 50% 30%, #ff9d9d, #ff2d2d 70%);
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    font-family: var(--font-display);
    font-size: 13px;
    color: #fff;
    line-height: 1;
  }

  .switch {
    position: relative;
    flex: none;
    width: 64px;
    height: 34px;
    border-radius: 99px;
    background: linear-gradient(180deg, #7a6a8a, #a597b3);
    border: 3px solid #4a3d59;
    box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.35);
    transition: background 0.2s ease, border-color 0.2s ease;
  }

  .switch::after {
    content: '';
    position: absolute;
    top: 1px;
    left: 2px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 30%, #fff, #e3dbe9 70%);
    box-shadow: 0 3px 5px rgba(0, 0, 0, 0.4);
    transition: translate 0.22s var(--ease-pop);
  }

  .switch[aria-checked='true'] {
    background: linear-gradient(180deg, #3fbf12, #86ef4c);
    border-color: #1d6a06;
  }

  .switch[aria-checked='true']::after {
    translate: 30px 0;
  }

  .bar {
    position: relative;
    height: 16px;
    border-radius: 99px;
    background: rgba(30, 0, 50, 0.55);
    border: 2px solid rgba(255, 255, 255, 0.35);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4);
    overflow: hidden;
  }

  .bar__fill {
    position: absolute;
    inset: 0 auto 0 0;
    width: calc(var(--p, 0) * 100%);
    border-radius: 99px;
    background: linear-gradient(180deg, #b6ff7a, #4ccf19 55%, #2f9d0d);
    box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.5);
    transition: width 0.45s var(--ease-out);
  }

  .bar--gold .bar__fill {
    background: linear-gradient(180deg, #fff39b, #ffc21a 55%, #e28500);
  }

  .bar--pink .bar__fill {
    background: linear-gradient(180deg, #ffc0e6, #ff5fb5 55%, #cc1f86);
  }

  .star {
    display: inline-block;
    width: 28px;
    height: 28px;
  }

  .spinner {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 5px solid rgba(255, 255, 255, 0.25);
    border-top-color: #fff;
    animation: mm-spin 0.9s linear infinite;
  }

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

@layer fx {
  @keyframes mm-spin {
    to {
      rotate: 360deg;
    }
  }

  @keyframes mm-pop-in {
    0% {
      opacity: 0;
      scale: 0.4;
    }

    60% {
      opacity: 1;
      scale: 1.08;
    }

    100% {
      opacity: 1;
      scale: 1;
    }
  }

  @keyframes mm-pop-out {
    to {
      opacity: 0;
      scale: 0.6;
    }
  }

  @keyframes mm-float {
    0%,
    100% {
      translate: 0 0;
    }

    50% {
      translate: 0 -7px;
    }
  }

  @keyframes mm-pulse {
    0%,
    100% {
      scale: 1;
    }

    50% {
      scale: 1.07;
    }
  }

  @keyframes mm-wiggle {
    0%,
    100% {
      rotate: 0deg;
    }

    25% {
      rotate: -9deg;
    }

    75% {
      rotate: 9deg;
    }
  }

  @keyframes mm-shine {
    0% {
      translate: -120% 0;
    }

    60%,
    100% {
      translate: 220% 0;
    }
  }

  @keyframes mm-fade-in {
    from {
      opacity: 0;
    }
  }

  @keyframes mm-rise {
    from {
      opacity: 0;
      translate: 0 24px;
    }
  }

  @keyframes mm-drop {
    0% {
      opacity: 0;
      translate: 0 -60px;
    }

    70% {
      opacity: 1;
      translate: 0 6px;
    }

    100% {
      translate: 0 0;
    }
  }
}

@layer state {
  [data-motion='reduced'] *,
  [data-motion='reduced'] *::before,
  [data-motion='reduced'] *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.05s !important;
  }
}
