/*
Theme Name: Spin WMT
Theme URI: https://wemastertrade.com
Author: WeMasterTrade
Description: WeMasterTrade September Reward Festival Lucky Spin Theme
Version: 1.0.0
*/

:root {
  --color-gold: #d4af37;
  --color-gold-light: #f5e6a8;
  --color-gold-deep: #d4af37;

  --color-text-primary: #ffffff;
  --color-text-on-gold: #0a1a3f;
  --color-text-muted: #848484;
  --color-text-dark: #000000;
  --color-text-grey: #6d6d6d;
  --color-text-prize: rgba(26, 26, 26, 0.8);

  --color-surface-card: rgba(18, 18, 18, 0.8);
  --color-surface-panel: rgba(18, 18, 18, 0.8);
  --color-surface-popup: #fcf4e5;
  --color-surface-input: rgba(26, 26, 26, 0.8);
  --color-surface-item: rgba(255, 255, 255, 0.02);
  --color-surface-chip: rgba(212, 175, 55, 0.12);
  --color-surface-close: rgba(255, 255, 255, 0.04);

  --color-border-gold: #d4af37;
  --color-border-gold-soft: rgba(212, 175, 55, 0.4);
  --color-border-cool: rgba(168, 180, 208, 0.16);
  --color-border-divider: rgba(168, 180, 208, 0.2);

  --color-error-fill: rgba(239, 68, 68, 0.3);
  --color-error-border: rgba(239, 68, 68, 0.5);

  --color-backdrop: rgba(0, 0, 0, 0.8);

  --gradient-gold-button: linear-gradient(
    111.546deg,
    var(--color-gold) 0%,
    var(--color-gold-light) 50%,
    var(--color-gold-deep) 100%
  );
  --gradient-gold-title: linear-gradient(
    108.112deg,
    var(--color-gold) 0%,
    var(--color-gold-light) 50%,
    var(--color-gold-deep) 100%
  );
  --gradient-gold-heading: linear-gradient(
    133.131deg,
    var(--color-gold) 0%,
    var(--color-gold-light) 50%,
    var(--color-gold-deep) 100%
  );
  --gradient-gold-subtitle: linear-gradient(
    144.477deg,
    var(--color-gold) 0%,
    var(--color-gold-light) 50%,
    var(--color-gold-deep) 100%
  );
  --gradient-gold-panel: linear-gradient(
    122.864deg,
    var(--color-gold) 0%,
    var(--color-gold-light) 50%,
    var(--color-gold-deep) 100%
  );
  --gradient-congrats: linear-gradient(to right, #facc15, #e9a62b);
  --gradient-prize-box: linear-gradient(
    to bottom,
    rgba(212, 175, 55, 0.1) 0%,
    rgba(212, 175, 55, 0.02) 100%
  );

  --font-sans: "Poppins", system-ui, sans-serif;
  --font-numeric: "Inter", "Poppins", system-ui, sans-serif;

  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.25rem;
  --font-size-xl: 1.5rem;
  --font-size-congrats: 1.625rem;
  --font-size-2xl: 2rem;
  --font-size-subtitle: 2rem;

  --font-weight-light: 300;
  --font-weight-regular: 400;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  --letter-spacing-tight: 0.0125rem;

  --radius-sm: 0.625rem;
  --radius-md: 0.875rem;
  --radius-lg: 1rem;
  --radius-xl: 1.125rem;
  --radius-2xl: 1.25rem;
  --radius-3xl: 1.5rem;
  --radius-full: 62.4375rem;

  --shadow-cta: 0 6px 22px 0 rgba(212, 175, 55, 0.25);
  --shadow-cta-inset: inset 0 1px 0 0 var(--color-gold-light);
  --shadow-surface-inset: inset 0 1px 0 0 rgba(212, 175, 55, 0.13);
  --shadow-panel: 0 30px 80px 0 rgba(0, 0, 0, 0.35);
  --shadow-popup: 0 30px 40px rgba(0, 0, 0, 0.35);

  --motion-fast: 120ms;
  --motion-base: 220ms;
  --motion-ease: cubic-bezier(0.22, 1, 0.36, 1);

  --spin-duration: 5s;
  --spin-ease: cubic-bezier(0.17, 0.67, 0.12, 0.99);

  --wheel-w: 659px;
  --logo-w: 426px;
  --entry-w: 782px;
  --title-w: 782px;
  --panel-w: 405px;
  --entry-gap: 48px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font-sans);
  color: var(--color-text-primary);
  background-color: #060606;
  /* The art's spotlight/podium axis sits 18px right of centre in the 1920x1080
     image, so it's shifted left to line up with the centred form and wheel.
     Same as `cover`, scaled up 2% so the shift never exposes an edge, and
     anchored so the podium glow line (y 836/1080) stays where it was. */
  --bg-w0: max(100vw, 100vh * 16 / 9);
  --bg-h0: max(100vh, 100vw * 9 / 16);
  --bg-k: 1.02;
  --bg-shift-x: 18 / 1920;
  --bg-anchor-y: 836 / 1080;
  background-image: url("./assets/background.png");
  background-size: calc(var(--bg-w0) * var(--bg-k)) calc(var(--bg-h0) * var(--bg-k));
  background-position:
    calc(50vw - var(--bg-w0) * var(--bg-k) * (0.5 + var(--bg-shift-x)))
    calc(50vh + var(--bg-h0) * (var(--bg-anchor-y) - 0.5 - var(--bg-anchor-y) * var(--bg-k)));
  background-repeat: no-repeat;
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img {
  display: block;
  max-width: 100%;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.u-gold-text {
  background-image: var(--gradient-gold-title);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.u-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
}

.screen[hidden] {
  display: none;
}

.screen--code-entry {
  position: relative;
  padding: 5px 10px 200px;
}

.screen--code-entry::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: linear-gradient(
    179.14deg,
    rgba(0, 0, 0, 0.2) 28.471%,
    rgba(0, 0, 0, 0) 38.949%
  );
  pointer-events: none;
}

.screen--spin-wheel {
  position: relative;
  padding: 79px 10px 88px;
}

.brand-logo {
  display: block;
  width: min(var(--logo-w), 100%);
  aspect-ratio: 426 / 89;
  background-image: url("./assets/logo-gold.png");
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
}

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 16px 24px;
  border: 0;
  border-radius: var(--radius-full);
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-bold);
  letter-spacing: var(--letter-spacing-tight);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  transition:
    transform var(--motion-fast) var(--motion-ease),
    filter var(--motion-base) var(--motion-ease),
    opacity var(--motion-base) var(--motion-ease);
}

.btn--primary {
  color: var(--color-text-on-gold);
  background-image: var(--gradient-gold-button);
  box-shadow: var(--shadow-cta), var(--shadow-cta-inset);
}

.btn--primary:hover:not(:disabled):not([aria-disabled="true"]) {
  filter: brightness(1.06);
}

.btn--primary:active:not(:disabled):not([aria-disabled="true"]) {
  transform: translateY(1px);
}

.btn:focus-visible {
  outline: 2px solid var(--color-gold-light);
  outline-offset: 3px;
}

.btn:disabled,
.btn[aria-disabled="true"],
.btn.is-disabled {
  opacity: 0.3;
  cursor: not-allowed;
  filter: none;
  transform: none;
}

.btn--confirm,
.btn--spin {
  width: 236px;
  height: 51px;
}

.screen--spin-wheel .btn--spin:not(:disabled):not([aria-disabled="true"]) {
  animation: spin-cta-pulse 2.2s ease-out infinite;
}

@keyframes spin-cta-pulse {
  0% {
    box-shadow: var(--shadow-cta), var(--shadow-cta-inset),
      0 0 0 0 rgba(245, 230, 168, 0.55);
  }
  55% {
    box-shadow: var(--shadow-cta), var(--shadow-cta-inset),
      0 0 0 12px rgba(245, 230, 168, 0);
  }
  100% {
    box-shadow: var(--shadow-cta), var(--shadow-cta-inset),
      0 0 0 12px rgba(245, 230, 168, 0);
  }
}

.screen--spin-wheel .btn--spin:focus-visible {
  outline: none;
}

.btn--block {
  width: 100%;
}

/* ---------- Code entry ---------- */

/* Decorative prize cards floating around the entry form. Positions and sizes
   are the Figma 1920x1080 frame values, as % of the screen so the layout
   scales with the viewport. Each card bobs on its own duration and phase. */
.floating-cards {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.floating-card {
  position: absolute;
  left: calc(var(--x) / 1920 * 100%);
  top: calc(var(--y) / 1080 * 100%);
  width: calc(var(--w) / 1920 * 100%);
  height: auto;
  animation: floating-card-bob var(--dur, 5s) ease-in-out var(--delay, 0s) infinite;
  will-change: transform;
}

.floating-card--15k    { --x: 238;  --y: 262; --w: 135; --dur: 5.2s; --delay: -0.4s; }
.floating-card--10k    { --x: 1643; --y: 122; --w: 167; --dur: 5.8s; --delay: -2.1s; }
.floating-card--iphone { --x: 1576; --y: 434; --w: 245; --dur: 6.4s; --delay: -1.2s; }
.floating-card--28     { --x: 94;   --y: 540; --w: 144; --dur: 5.7s; --delay: -2.7s; }
.floating-card--25     { --x: 238;  --y: 862; --w: 133; --dur: 5.5s; --delay: -3.3s; }
.floating-card--30     { --x: 1529; --y: 766; --w: 134; --dur: 6s;   --delay: -4.2s; }

@keyframes floating-card-bob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-12px);
  }
}

.entry-stack {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--entry-gap);
  width: min(var(--entry-w), 100%);
}

.entry-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 100%;
}

.entry-head .brand-logo {
  width: min(calc(var(--logo-w) * 0.8), 100%);
}

.event-title {
  width: min(var(--title-w), 100%);
  margin: 0;
}

.event-title__image {
  width: 100%;
  height: auto;
}

.event-subtitle {
  margin: 0;
  font-size: var(--font-size-subtitle);
  font-weight: var(--font-weight-semibold);
  line-height: normal;
  text-align: center;
  white-space: nowrap;
  background-image: var(--gradient-gold-subtitle);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.code-card {
  position: relative;
  display: flex;
  justify-content: center;
  width: 100%;
  padding: 48px 64px;
  border: 1.5px solid var(--color-border-gold);
  border-radius: var(--radius-3xl);
  box-shadow: var(--shadow-surface-inset);
}

.code-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background-color: var(--color-surface-card);
  backdrop-filter: blur(1.8px);
  -webkit-backdrop-filter: blur(1.8px);
  pointer-events: none;
}

.code-form {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  width: min(527px, 100%);
}

.code-form__title {
  width: 100%;
  margin: 0;
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-semibold);
  line-height: normal;
  text-align: center;
  word-break: break-word;
  background-image: var(--gradient-gold-heading);
}

.field {
  width: min(418px, 100%);
  padding: 6px;
  border: 1px solid var(--color-border-gold);
  border-radius: var(--radius-md);
  transition: box-shadow var(--motion-base) var(--motion-ease);
}

.field:focus-within {
  box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.13);
}

.field__inner {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 59.75px;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  background-color: var(--color-surface-input);
  overflow: hidden;
}

.field__icon-box {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 33.419px;
  height: 33.419px;
}

.field__icon {
  transform: rotate(-34.94deg);
}

.field__divider {
  flex: 0 0 auto;
  transform: rotate(90deg);
  margin: 0 -12.5px;
}

.field__input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-regular);
  color: var(--color-text-primary);
}

.field__input::placeholder {
  color: var(--color-text-muted);
}

.field__input:focus {
  outline: none;
}

/* ---------- Spin wheel ---------- */

.spin-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 26px;
  width: var(--wheel-w);
  max-width: 100%;
}

.spin-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(var(--logo-w), 100%);
}

.wheel {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  /* room for the podium base below the wheel */
  margin-bottom: 13%;
}

/* Podium base sits behind and below the wheel, so the disc appears mounted on it. */
.wheel__base {
  position: absolute;
  left: 50%;
  top: 76%;
  width: 46%;
  height: auto;
  transform: translateX(-50%);
  z-index: 0;
  pointer-events: none;
}

/* Ground shadow under the podium, positioned from the base's bottom edge
   (76% top + 46% width * 548/700 base aspect). Precedes the base in the DOM
   so it paints beneath it. */
.wheel__shadow {
  position: absolute;
  left: 50%;
  /* Figma (578px wheel): 336px wide incl. blur, centred 4.6px above the base's bottom edge. */
  top: calc(76% + 46% * 548 / 700 - 100% * 4.6 / 578);
  width: calc(100% * 336 / 578);
  height: auto;
  transform: translate(-50%, -50%);
  z-index: 0;
  pointer-events: none;
}

/* The rotating prize disc, seated inside the static bulb ring.
   Sized to tuck under the ring band. The disc's true centre (circle fit of
   its rim and hub in spinning.png) is at (49.91%, 49.90%) of the image, so
   the disc pivots there, and that pivot is placed on the ring's hole centre
   (49.85%, 50.61% of frame-ring.png). Otherwise the disc wobbles while spinning. */
.wheel__rotor {
  --rotor-pivot-x: 49.91%;
  --rotor-pivot-y: 49.9%;
  position: absolute;
  left: 49.85%;
  top: 50.61%;
  width: 88%;
  height: 88%;
  object-fit: contain;
  z-index: 1;
  transform: translate(calc(-1 * var(--rotor-pivot-x)), calc(-1 * var(--rotor-pivot-y)))
    rotate(var(--rotor-angle, 0deg));
  transform-origin: var(--rotor-pivot-x) var(--rotor-pivot-y);
  will-change: transform;
}

.wheel__rotor.is-spinning {
  transition: transform var(--spin-duration) var(--spin-ease);
}

/* Static gold bulb ring + pointer overlay (transparent centre). */
.wheel__ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  z-index: 2;
  pointer-events: none;
  filter: drop-shadow(0 12px 30px rgba(0, 0, 0, 0.4));
}

.tooltip-wrap {
  position: relative;
  display: inline-flex;
}

.tooltip {
  position: absolute;
  bottom: calc(100% + 14px);
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: 280px;
  padding: 10px 14px;
  border: 1px solid var(--color-border-cool);
  border-radius: var(--radius-sm);
  background-color: rgba(10, 10, 10, 0.92);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: var(--shadow-panel);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-regular);
  line-height: 1.5;
  color: var(--color-text-primary);
  text-align: center;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity var(--motion-base) var(--motion-ease),
    visibility var(--motion-base) var(--motion-ease);
  pointer-events: none;
  z-index: 3;
}

.tooltip[hidden] {
  display: none;
}

.tooltip__arrow {
  position: absolute;
  top: 100%;
  left: 50%;
  width: 10px;
  height: 10px;
  margin-left: -5px;
  margin-top: -5px;
  border-right: 1px solid var(--color-border-cool);
  border-bottom: 1px solid var(--color-border-cool);
  background-color: rgba(10, 10, 10, 0.92);
  transform: rotate(45deg);
}

.tooltip-wrap[data-tooltip-eligible="true"]:hover .tooltip,
.tooltip-wrap[data-tooltip-eligible="true"]:focus-within .tooltip,
.tooltip-wrap[data-tooltip-active="true"] .tooltip {
  opacity: 1;
  visibility: visible;
}

/* ---------- Prize panel ---------- */

.prize-panel {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: var(--panel-w);
  max-width: 100%;
  padding: 38px 27px;
  border: 1px solid var(--color-border-gold);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-panel), var(--shadow-surface-inset);
}

.prize-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background-color: var(--color-surface-panel);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  pointer-events: none;
}

.prize-panel__title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  line-height: normal;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.prize-panel__title span {
  background-image: var(--gradient-gold-panel);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.prize-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.prize-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46.2px;
  padding: 11px 13px;
  border: 1px solid var(--color-border-cool);
  border-radius: var(--radius-sm);
  background-color: var(--color-surface-item);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-regular);
  line-height: normal;
  color: var(--color-text-primary);
}

.prize-item__rank {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: var(--color-surface-chip);
  font-family: var(--font-numeric);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  color: var(--color-gold);
}

.prize-item__medal {
  flex: 0 0 auto;
  line-height: 1;
}

/* Top 3 prizes: a medal-coloured glow that breathes, plus a light sweep that
   cascades down the three rows. Strength steps down from gold to bronze. */
.prize-item--tier-1 {
  --tier-rgb: 245, 206, 92;
  --tier-glow: 0.55;
  --tier-blur: 18px;
  --shine-delay: 0s;
}

.prize-item--tier-2 {
  --tier-rgb: 214, 222, 235;
  --tier-glow: 0.36;
  --tier-blur: 14px;
  --shine-delay: 0.3s;
}

.prize-item--tier-3 {
  --tier-rgb: 222, 146, 84;
  --tier-glow: 0.3;
  --tier-blur: 12px;
  --shine-delay: 0.6s;
}

.prize-item--tier-1,
.prize-item--tier-2,
.prize-item--tier-3 {
  gap: 6px;
  border-color: rgba(var(--tier-rgb), 0.55);
  background-image: linear-gradient(
    90deg,
    rgba(var(--tier-rgb), 0.12) 0%,
    rgba(var(--tier-rgb), 0.02) 100%
  );
}

.prize-item--tier-1::before,
.prize-item--tier-2::before,
.prize-item--tier-3::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  box-shadow:
    0 0 var(--tier-blur) rgba(var(--tier-rgb), var(--tier-glow)),
    inset 0 0 10px rgba(var(--tier-rgb), calc(var(--tier-glow) * 0.35));
  opacity: 0.35;
  animation: prize-glow 2.8s ease-in-out infinite alternate;
  pointer-events: none;
}

.prize-item--tier-1::after,
.prize-item--tier-2::after,
.prize-item--tier-3::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background-image: linear-gradient(
    105deg,
    transparent 42%,
    rgba(255, 255, 255, 0.32) 50%,
    transparent 58%
  );
  background-size: 300% 100%;
  background-repeat: no-repeat;
  background-position: 125% 0;
  animation: prize-shine 3.6s ease-in-out var(--shine-delay) infinite;
  pointer-events: none;
}

@keyframes prize-glow {
  to {
    opacity: 1;
  }
}

/* Sweep takes the first ~40% of the cycle, then rests until the next pass. */
@keyframes prize-shine {
  0% {
    background-position: 125% 0;
  }
  40%,
  100% {
    background-position: -25% 0;
  }
}

/* ---------- Modals ---------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
}

.modal[hidden] {
  display: none;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background-color: var(--color-backdrop);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal__card {
  position: relative;
  z-index: 2;
  border: 1px solid var(--color-border-gold);
  background-color: var(--color-surface-popup);
  box-shadow: var(--shadow-popup), var(--shadow-surface-inset);
  animation: modal-in var(--motion-base) var(--motion-ease) both;
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.modal__close {
  position: absolute;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 35px;
  height: 35px;
  padding: 0;
  border: 1px solid var(--color-border-gold);
  border-radius: 50%;
  background-color: var(--color-surface-close);
  font-size: 18px;
  font-weight: var(--font-weight-light);
  line-height: 1;
  color: var(--color-gold);
  transition: background-color var(--motion-base) var(--motion-ease);
  z-index: 3;
}

.modal__close:hover {
  background-color: rgba(212, 175, 55, 0.12);
}

.modal__close:focus-visible {
  outline: 2px solid var(--color-gold);
  outline-offset: 2px;
}

.modal__card--wrong-code {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: min(417px, 100%);
  padding: 24px 22px;
  border-radius: var(--radius-3xl);
}

.modal__card--wrong-code .modal__close {
  top: 14px;
  right: 16px;
}

.modal__icon-row {
  display: flex;
  justify-content: center;
  padding-top: 21px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--color-border-divider);
}

.modal__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border: 1.334px solid var(--color-error-border);
  border-radius: 50%;
  background-color: var(--color-error-fill);
}

.modal__text {
  text-align: center;
  color: var(--color-text-dark);
  word-break: break-word;
}

.modal__text p {
  margin: 0;
  line-height: normal;
}

.modal__message {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
}

.modal__sub,
.modal__note {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-regular);
}

.modal__text .modal__note {
  margin-top: 1.5em;
}

.modal__card--wrong-code .btn {
  height: 54.19px;
  margin-top: 8px;
}

.modal__card--result {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 17px;
  width: min(360px, 100%);
  padding: 49px 33px;
  border-radius: var(--radius-2xl);
}

.modal__card--result .modal__close {
  top: 12px;
  right: 19px;
}

.result__title {
  margin: 0;
  font-size: var(--font-size-congrats);
  font-style: italic;
  font-weight: var(--font-weight-bold);
  line-height: 31px;
  text-align: center;
  background-image: var(--gradient-congrats);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.result__subtitle {
  margin: 0;
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-regular);
  text-align: center;
  color: var(--color-text-grey);
}

.result__body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  width: 100%;
}

.result__prize {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: 174.67px;
  padding: 23px 19px;
  border: 1px solid var(--color-border-gold-soft);
  border-radius: var(--radius-lg);
  background-image: var(--gradient-prize-box);
}

.result__prize-image-wrap {
  width: 110px;
  height: 110px;
  overflow: hidden;
}

.result__prize-image {
  width: 110px;
  height: 110px;
  max-width: none;
}

.result__prize-name {
  margin: 0;
  font-size: var(--font-size-lg);
  font-style: italic;
  font-weight: var(--font-weight-bold);
  line-height: 31px;
  text-align: center;
  color: var(--color-text-prize);
}

.result__note {
  margin: 0;
  font-size: var(--font-size-xs);
  font-style: italic;
  font-weight: var(--font-weight-regular);
  line-height: normal;
  text-align: center;
  color: var(--color-text-grey);
}

.modal__card--result .btn {
  height: 50.86px;
  font-family: var(--font-numeric);
}

.result__confetti {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

/* ---------- Responsive (mirrors the Japan build) ---------- */

@media (max-width: 1280px) {
  :root {
    --wheel-w: 560px;
  }
}

/* Below this the panel can no longer sit beside the wheel, so it stacks under it. */
@media (max-width: 1080px) {
  :root {
    --wheel-w: 520px;
  }

  .screen--spin-wheel {
    flex-direction: column;
    gap: 28px;
  }
}

@media (max-width: 760px) {
  :root {
    --wheel-w: min(440px, 88vw);
    --font-size-2xl: 1.625rem;
    --title-w: 100%;
    --font-size-subtitle: clamp(1.125rem, 5vw, 1.5rem);
    --logo-w: min(320px, 80vw);
    --entry-gap: 48px;
  }

  .screen--code-entry {
    padding: 24px 16px 96px;
  }

  .event-subtitle {
    white-space: normal;
    text-wrap: balance;
  }

  /* No room beside the form on mobile; the cards would cover the title and form. */
  .floating-cards {
    display: none;
  }

  .screen--spin-wheel {
    padding: 48px 16px 56px;
  }

  .code-card {
    padding: 40px 24px;
  }
}

/*
 * Desktop: the wheel grows to fill the viewport height (up to the 659px design
 * size) instead of stepping down at fixed breakpoints. Column height =
 * logo (w * 89/426) + 2 gaps + wheel (w * 1.04636) + button + vertical padding.
 */
@media (min-width: 1001px) {
  .screen--spin-wheel {
    --spin-pad-y: 167px;
    --spin-gap: 26px;
    --spin-btn-h: 51px;
    --wheel-fit: calc(
      (100vh - var(--spin-pad-y) - var(--logo-w) * 0.20892 - 2 * var(--spin-gap) - var(--spin-btn-h)) / 1.14
    );
  }

  .spin-main {
    width: min(var(--wheel-w), max(300px, var(--wheel-fit)));
    gap: var(--spin-gap);
  }

  .btn--spin {
    height: var(--spin-btn-h);
  }
}

/* Panel beside the wheel. Wide screens keep the wheel centred with the panel
   in the right gutter (Figma: 56px from the wheel column, 121px from the top);
   narrower desktops centre wheel + panel as a pair. */
@media (min-width: 1081px) {
  .screen--spin-wheel {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-content: center;
    align-items: start;
  }

  .spin-main {
    grid-column: 2;
  }

  .prize-panel {
    grid-column: 3;
    justify-self: start;
    margin-top: var(--panel-offset, 42px);
    margin-left: 56px;
  }
}

@media (min-width: 1081px) and (max-width: 1679px) {
  .screen--spin-wheel {
    grid-template-columns: auto auto;
    justify-content: center;
    column-gap: 56px;
  }

  .spin-main {
    grid-column: 1;
  }

  .prize-panel {
    grid-column: 2;
    margin-left: 0;
  }
}

@media (min-width: 1081px) and (max-width: 1240px) {
  .screen--spin-wheel {
    column-gap: 32px;
  }

  .prize-panel {
    --panel-w: 360px;
    padding: 30px 20px;
  }
}

@media (min-width: 1001px) and (max-height: 1150px) {
  .screen--spin-wheel {
    --spin-pad-y: 64px;
    --panel-offset: 89px;
    padding-top: 32px;
    padding-bottom: 32px;
  }
}

@media (min-width: 1001px) and (max-height: 800px) {
  .screen--spin-wheel {
    --logo-w: 320px;
    --spin-gap: 20px;
    --spin-pad-y: 40px;
    --panel-offset: 40px;
    padding-top: 20px;
    padding-bottom: 20px;
  }

  .prize-panel {
    gap: 10px;
    padding: 26px 22px;
  }

  .prize-list {
    gap: 8px;
  }

  .prize-item {
    min-height: 40px;
    padding: 8px 12px;
  }
}

@media (min-width: 1001px) and (max-height: 730px) {
  .screen--spin-wheel {
    --logo-w: 260px;
    --spin-gap: 14px;
    --spin-btn-h: 44px;
    --spin-pad-y: 32px;
    --panel-offset: 24px;
    padding-top: 16px;
    padding-bottom: 16px;
  }
}

@media (max-width: 480px) {
  :root {
    --wheel-w: min(340px, 90vw);
    --font-size-2xl: 1.375rem;
  }

  .code-card {
    padding: 32px 18px;
  }

  .btn--confirm,
  .btn--spin {
    /* % would resolve against the shrink-to-fit tooltip wrapper */
    width: min(236px, calc(100vw - 32px));
  }

  .modal__card--result {
    padding: 40px 20px;
  }

  .prize-panel {
    padding: 28px 18px;
  }
}

@media (min-width: 761px) and (max-height: 1000px) {
  :root {
    --entry-gap: 36px;
    --title-w: 640px;
    --font-size-subtitle: 1.625rem;
  }

  .screen--code-entry {
    padding: 32px 10px 80px;
  }
}

@media (min-width: 761px) and (max-height: 820px) {
  :root {
    --entry-w: 620px;
    --logo-w: 340px;
    --entry-gap: 28px;
    --title-w: 480px;
    --font-size-subtitle: 1.375rem;
  }

  .screen--code-entry {
    padding: 20px 10px 32px;
  }

  .code-card {
    padding: 32px 40px;
  }

  .code-form {
    gap: 20px;
  }

  .code-form__title {
    font-size: 1.5rem;
  }

  .field__inner {
    height: 48px;
    padding: 10px 14px;
  }

  .btn--confirm {
    height: 44px;
  }
}

@media (min-width: 761px) and (max-height: 680px) {
  :root {
    --entry-w: 500px;
    --logo-w: 260px;
    --entry-gap: 16px;
    --title-w: 360px;
    --font-size-subtitle: 1.125rem;
  }

  .screen--code-entry {
    padding: 12px 10px 16px;
  }

  .code-card {
    padding: 22px 28px;
  }

  .code-form {
    gap: 14px;
  }

  .code-form__title {
    font-size: 1.125rem;
  }

  .field__inner {
    height: 40px;
    padding: 8px 12px;
  }

  .btn--confirm {
    height: 38px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .modal__card {
    animation: none;
  }

  .wheel__rotor.is-spinning {
    transition: none;
  }

  .floating-card {
    animation: none;
  }

  .screen--spin-wheel .btn--spin:not(:disabled):not([aria-disabled="true"]) {
    animation: none;
  }

  .prize-item--tier-1::before,
  .prize-item--tier-2::before,
  .prize-item--tier-3::before {
    animation: none;
    opacity: 0.75;
  }

  .prize-item--tier-1::after,
  .prize-item--tier-2::after,
  .prize-item--tier-3::after {
    display: none;
  }

  .screen--spin-wheel .btn--spin:focus-visible {
    outline: 2px solid var(--color-gold-light);
    outline-offset: 3px;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}
