:root {
  --carters-blue: #08a9e6;
  --oshkosh-navy: #08284d;
  --deep-blue: #06355f;
  --mid-blue: #42a9dc;
  --sky: #8fcdeb;
  --pale-sky: #dff3fb;
  --white: #ffffff;
  --line: #d6dfe8;
  --text: #071d3d;
  --muted: #55708a;
  --danger: #ec1b25;
  --shadow: 0 24px 70px rgba(7, 29, 61, 0.18);
  --spin-duration: 3s;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  height: 100vh;
  height: 100svh;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
  background:
    radial-gradient(
      circle at 50% 105%,
      rgba(255, 255, 255, 0.68),
      transparent 30%
    ),
    repeating-conic-gradient(
      from -10deg at 50% 68%,
      rgba(255, 255, 255, 0.13) 0deg 8deg,
      transparent 8deg 18deg
    ),
    linear-gradient(145deg, #9dd5ee 0%, #76bee4 54%, #5bb0dd 100%);
  overflow: hidden;
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

button:disabled {
  cursor: wait;
  opacity: 0.72;
}

label .required-sign {
  color: var(--danger);
  font-weight: 700;
}

.page-loader {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  left: 50%;
  z-index: 1000;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 24px rgba(7, 29, 61, 0.22);
  transform: translateX(-50%);
  transition: opacity 180ms ease, visibility 180ms ease;
}

.page-loader.is-hidden {
  visibility: hidden;
  opacity: 0;
}

.page-loader-icon {
  width: 25px;
  height: 25px;
  border: 3px solid rgba(8, 169, 230, 0.24);
  border-top-color: var(--carters-blue);
  border-radius: 50%;
  animation: page-loader-turn 700ms linear infinite;
}

@keyframes page-loader-turn {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .page-loader-icon {
    animation-duration: 1.5s;
  }
}

.screen {
  height: 100vh;
  height: 100svh;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px 18px;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  contain: layout paint;
}

.screen.is-active {
  display: flex;
}

.brand-lockup {
  display: block;
  width: min(520px, 84%);
  height: auto;
  margin-bottom: 26px;
  margin-left: auto;
  margin-right: auto;
  object-fit: contain;
  user-select: none;
}

.card {
  width: min(880px, 100%);
  max-height: calc(100svh - 28px);
  background: var(--white);
  border-radius: 18px;
  padding: 30px 44px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.register-card {
  padding-bottom: 22px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px 30px;
}

.form-field:first-child {
  grid-column: 1 / -1;
}

label {
  display: block;
  margin-bottom: 8px;
  color: #021532;
  font-size: 17px;
}

input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 15px;
  color: var(--text);
  outline: none;
  transition:
    border 170ms ease,
    box-shadow 170ms ease;
}

input:focus {
  border-color: var(--carters-blue);
  box-shadow: 0 0 0 4px rgba(8, 169, 230, 0.12);
}

.submit-btn,
.return-btn,
.copy-btn {
  min-height: 50px;
  border: 0;
  border-radius: 8px;
  background: var(--mid-blue);
  color: var(--white);
  padding: 0 24px;
  cursor: pointer;
  transition:
    transform 140ms ease,
    background 140ms ease,
    opacity 140ms ease;
}

.submit-btn {
  grid-column: 1 / -1;
  width: 100%;
  border: 2px solid #14b8f0;
  background: var(--white);
  color: var(--text);
  min-height: 46px;
  font-size: 18px;
}

.submit-btn:hover,
.return-btn:hover,
.copy-btn:hover {
  transform: translateY(-1px);
}

.submit-btn:active,
.return-btn:active,
.copy-btn:active {
  transform: translateY(0);
}

.submit-btn:hover {
  background: #f4fbff;
}

.gift-pile {
  display: block;
  width: min(330px, 58vw);
  max-height: 21vh;
  margin: 18px auto 0;
  object-fit: contain;
}

.screen.wheel-screen {
  --wheel-bg-image: url("assets/wheel-bg.webp");
  --stage-inline-padding: clamp(16px, 3vw, 42px);
  --stage-padding-top: clamp(30px, 5svh, 56px);
  --stage-padding-bottom: clamp(14px, 2.8svh, 30px);
  --stage-row-gap: clamp(10px, 2svh, 24px);
  --wheel-size: min(520px, 50vw, calc(100svh - 340px));
  --wheel-gift-width: min(300px, 31vw);
  --wheel-gift-gap: clamp(8px, 1.8svh, 24px);
  --wheel-heading-size: clamp(40px, 4.1vw, 58px);
  --bottom-brand-logo-width: clamp(210px, 26vw, 330px);
  --stand-scale: 122%;
  --stand-offset-y: -13%;

  align-items: stretch;
  padding: 0;
  overflow: hidden;
  background-color: #74c3e6;
  background-image: var(--wheel-bg-image);
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

.wheel-stage {
  width: 100%;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: var(--stage-row-gap);
  justify-items: center;
  align-items: stretch;
  position: relative;
  padding: var(--stage-padding-top) var(--stage-inline-padding)
    var(--stage-padding-bottom);
  overflow: hidden;
}

.wheel-heading {
  position: relative;
  z-index: 1;
  align-self: start;
  margin: 0;
  color: var(--white);
  font-size: var(--wheel-heading-size);
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.03em;
  text-align: center;
  text-transform: uppercase;
  text-shadow: 0 4px 18px rgba(8, 40, 77, 0.15);
}

.wheel-area {
  position: relative;
  z-index: 1;
  align-self: center;
  width: var(--wheel-size);
  max-width: 100%;
  display: grid;
  grid-template-rows: auto auto;
  gap: var(--wheel-gift-gap);
  justify-items: center;
  align-content: center;
  isolation: isolate;
}

.wheel-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  filter: drop-shadow(0 18px 22px rgba(8, 40, 77, 0.18));
  contain: layout;
}

.wheel-stand {
  position: absolute;
  top: var(--stand-offset-y);
  left: 50%;
  width: var(--stand-scale);
  height: auto;
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 6;
  user-select: none;
}

.wheel-dot-layer {
  position: absolute;
  top: var(--stand-offset-y);
  left: 50%;
  width: var(--stand-scale);
  aspect-ratio: 1122 / 1402;
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 5;
}

.pointer {
  position: absolute;
  top: clamp(13px, calc(var(--wheel-size) * 0.04), 22px);
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: clamp(14px, calc(var(--wheel-size) * 0.04), 22px) solid
    transparent;
  border-right: clamp(14px, calc(var(--wheel-size) * 0.04), 22px) solid
    transparent;
  border-top: clamp(32px, calc(var(--wheel-size) * 0.085), 48px) solid
    var(--deep-blue);
  z-index: 7;
}

.wheel {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  position: relative;
  overflow: hidden;
  background: var(--deep-blue);
  border: clamp(14px, calc(var(--wheel-size) * 0.055), 30px) solid
    var(--deep-blue);
  transition: transform var(--spin-duration) cubic-bezier(0.12, 0.82, 0.2, 1);
  z-index: 2;
  transform: translateZ(0);
  backface-visibility: hidden;
  will-change: auto;
  contain: paint;
}

.wheel.is-spinning {
  will-change: transform;
}

.wheel::before {
  content: "";
  position: absolute;
  inset: 2%;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.55);
  pointer-events: none;
}

.wheel-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.slice-text {
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 950;
  line-height: 1;
  text-anchor: middle;
  dominant-baseline: middle;
  text-transform: uppercase;
  pointer-events: none;
}

.slice-text.is-light {
  fill: var(--white);
}

.slice-text.is-blue {
  fill: var(--carters-blue);
}

.wheel::after {
  content: "";
  position: absolute;
  inset: 42%;
  border-radius: 50%;
  background: var(--deep-blue);
  box-shadow:
    0 0 0 7px #0b9ed7,
    0 0 0 12px rgba(255, 255, 255, 0.55);
  z-index: 3;
}

.stand-dot {
  position: absolute;
  left: calc(var(--dot-x) * 1%);
  top: calc(var(--dot-y) * 1%);
  width: 1.8%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--white);
  transform: translate(-50%, -50%);
}

.go-button {
  position: absolute;
  top: 50%;
  left: 50%;
  width: clamp(54px, calc(var(--wheel-size) * 0.155), 88px);
  height: clamp(54px, calc(var(--wheel-size) * 0.155), 88px);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: clamp(5px, calc(var(--wheel-size) * 0.014), 7px) solid
    var(--deep-blue);
  background: #12aee8;
  color: var(--white);
  display: grid;
  place-items: center;
  font-size: clamp(20px, calc(var(--wheel-size) * 0.06), 34px);
  font-weight: 950;
  z-index: 8;
  cursor: pointer;
  box-shadow: 0 8px 16px rgba(8, 40, 77, 0.26);
  transition:
    transform 120ms ease,
    box-shadow 120ms ease,
    opacity 120ms ease;
  user-select: none;
  touch-action: manipulation;
}

.go-button:hover:not(:disabled) {
  box-shadow: 0 10px 20px rgba(8, 40, 77, 0.3);
}

.go-button:active {
  transform: translate(-50%, -50%) scale(0.97);
  box-shadow: 0 6px 12px rgba(8, 40, 77, 0.22);
}

.wheel-gifts {
  position: relative;
  width: var(--wheel-gift-width);
  max-width: 82vw;
  max-height: min(16svh, calc(var(--wheel-size) * 0.34));
  object-fit: contain;
  margin: 0;
  z-index: 5;
  user-select: none;
}

.bottom-brand {
  position: relative;
  z-index: 1;
  align-self: end;
  width: var(--bottom-brand-logo-width);
  max-width: 68vw;
  margin: 0 auto;
  transform: none;
  transform-origin: center center;
}

.result-card {
  text-align: center;
  min-height: 0;
  display: grid;
  align-content: center;
}

.result-card .brand-lockup {
  margin-bottom: 34px;
}

.result-title {
  margin: 0 0 16px;
  font-size: 30px;
  font-weight: 700;
  line-height: 1.15;
  color: var(--oshkosh-navy);
}

.result-line,
.promo-label,
.branch-line {
  margin: 0 0 16px;
  font-size: 19px;
  font-weight: 400;
  line-height: 1.35;
}

.player-details {
  display: grid;
  gap: 6px;
  margin: 0 0 16px;
  color: var(--oshkosh-navy);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.35;
}

.player-details p {
  margin: 0;
}

.player-details span {
  font-weight: 700;
}

.promo-label {
  margin-bottom: 8px;
  font-size: 17px;
}

.promo-code {
  margin: 0 0 18px;
  color: var(--mid-blue);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0.025em;
}

.hard-luck-message {
  margin: 0 auto 18px;
  max-width: 540px;
  color: var(--danger);
  font-size: 20px;
  font-weight: 500;
  line-height: 1.35;
}

.expiry {
  margin: 0 0 18px;
  color: var(--danger);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.35;
}

.promo-code.is-expired {
  color: var(--muted);
  text-decoration: line-through;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: 4px;
}

.copy-btn {
  background: var(--deep-blue);
}

.is-hidden {
  display: none;
}

@media (min-width: 1200px) and (min-height: 780px) {
  .screen.wheel-screen {
    --stage-padding-top: clamp(38px, 5svh, 58px);
    --stage-padding-bottom: clamp(18px, 2.8svh, 32px);
    --wheel-size: min(530px, 48vw, calc(100svh - 370px));
    --wheel-gift-width: min(330px, 30vw);
    --wheel-heading-size: clamp(52px, 3.7vw, 60px);
    --bottom-brand-logo-width: clamp(230px, 24vw, 350px);
  }
}

@media (min-width: 1600px) and (min-height: 850px) {
  .screen {
    padding: 30px 24px;
  }

  .card {
    width: min(980px, 100%);
    padding: 38px 54px;
  }

  .brand-lockup {
    width: min(600px, 84%);
    margin-bottom: 32px;
  }

  .form-grid {
    gap: 26px 36px;
  }

  label {
    font-size: 19px;
  }

  input {
    min-height: 54px;
    font-size: 18px;
  }

  .submit-btn,
  .return-btn,
  .copy-btn {
    min-height: 56px;
    font-size: 19px;
  }

  .gift-pile {
    width: min(390px, 54vw);
    max-height: 24vh;
    margin-top: 24px;
  }

  .screen.wheel-screen {
    --stage-padding-top: clamp(42px, 5svh, 64px);
    --stage-padding-bottom: clamp(20px, 2.8svh, 36px);
    --wheel-size: min(550px, 44vw, calc(100svh - 380px));
    --wheel-gift-width: min(350px, 28vw);
    --wheel-heading-size: clamp(56px, 3.5vw, 64px);
    --bottom-brand-logo-width: clamp(250px, 22vw, 370px);
  }

  .result-title {
    font-size: 34px;
  }

  .result-line,
  .branch-line {
    font-size: 21px;
  }

  .player-details {
    font-size: 19px;
  }

  .promo-label {
    font-size: 18px;
  }

  .promo-code,
  .hard-luck-message {
    font-size: 24px;
  }

  .expiry {
    font-size: 18px;
  }
}

@media (max-width: 980px) {
  .screen {
    padding: 16px 16px;
  }

  .brand-lockup {
    width: min(460px, 84%);
    margin-bottom: 22px;
  }

  .card {
    padding: 24px 30px;
  }

  .form-grid {
    gap: 18px 24px;
  }

  .gift-pile {
    width: min(300px, 58vw);
    margin-top: 14px;
  }

  .screen.wheel-screen {
    --stage-padding-top: clamp(24px, 4.2svh, 44px);
    --wheel-size: min(450px, 62vw, calc(100svh - 320px));
    --wheel-gift-width: min(280px, 42vw);
    --wheel-heading-size: clamp(36px, 4.6vw, 46px);
    --bottom-brand-logo-width: clamp(200px, 32vw, 300px);
  }

  .result-card .brand-lockup {
    margin-bottom: 26px;
  }

  .result-title {
    font-size: 27px;
  }

  .result-line,
  .branch-line {
    font-size: 19px;
  }

  .player-details,
  .promo-label {
    font-size: 17px;
  }

  .promo-code {
    font-size: 21px;
  }

  .hard-luck-message {
    font-size: 20px;
  }

  .expiry {
    font-size: 16px;
  }
}

@media (max-width: 980px) and (min-width: 721px) {
  .card {
    width: min(820px, 100%);
  }

  .screen.wheel-screen {
    --wheel-size: min(460px, 64vw, calc(100svh - 310px));
    --wheel-gift-width: min(300px, 40vw);
  }
}

@media (max-width: 720px) {
  body {
    overflow: hidden;
  }

  .screen {
    height: 100vh;
    height: 100svh;
    padding: 10px 12px;
    overflow: hidden;
  }

  .card {
    width: min(100%, 500px);
    max-height: none;
    border-radius: 14px;
    padding: 18px 16px;
  }

  .form-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .form-field:first-child,
  .submit-btn {
    grid-column: auto;
  }

  label {
    font-size: 15px;
  }

  input {
    min-height: 42px;
  }

  .brand-lockup {
    width: min(360px, 86%);
    margin-bottom: 16px;
  }

  .screen.wheel-screen {
    --stage-inline-padding: clamp(12px, 4vw, 22px);
    --stage-padding-top: clamp(56px, 11svh, 100px);
    --stage-padding-bottom: clamp(10px, 2svh, 18px);
    --stage-row-gap: clamp(6px, 1.2svh, 12px);
    --wheel-size: min(390px, 88vw, calc(100svh - 300px));
    --wheel-gift-width: min(250px, 62vw);
    --wheel-gift-gap: clamp(4px, 1svh, 10px);
    --wheel-heading-size: clamp(25px, 7vw, 34px);
    --bottom-brand-logo-width: clamp(170px, 54vw, 260px);
  }

  .wheel-stage {
    grid-template-rows: auto auto auto;
    align-content: start;
  }

  .bottom-brand {
    align-self: start;
    margin-top: clamp(2px, 0.8svh, 8px);
  }

  .result-card {
    min-height: 0;
  }

  .result-card .brand-lockup {
    margin-bottom: 20px;
  }

  .result-title {
    font-size: 23px;
  }

  .result-line,
  .branch-line {
    font-size: 17px;
  }

  .player-details,
  .promo-label {
    font-size: 16px;
  }

  .promo-code {
    font-size: 18px;
  }

  .hard-luck-message {
    font-size: 18px;
  }

  .expiry {
    font-size: 15px;
  }
}

@media (max-width: 450px) {
  .screen {
    padding: 8px 10px;
  }

  .card {
    padding: 15px 13px;
    /* margin-bottom: 182px; */
  }

  .brand-lockup {
    width: min(320px, 88%);
    margin-bottom: 14px;
  }

  .form-grid {
    gap: 10px;
  }

  label {
    margin-bottom: 6px;
    font-size: 14px;
  }

  input {
    min-height: 40px;
    padding: 9px 11px;
  }

  .submit-btn,
  .return-btn,
  .copy-btn {
    min-height: 44px;
    padding: 0 16px;
  }

  .gift-pile {
    width: min(250px, 66vw);
    max-height: 17vh;
    margin-top: 12px;
  }

  .screen.wheel-screen {
    --stage-padding-top: clamp(48px, 10svh, 86px);
    --wheel-size: min(340px, 88vw, calc(100svh - 285px));
    --wheel-gift-width: min(220px, 58vw);
    --wheel-heading-size: clamp(24px, 7vw, 30px);
    --bottom-brand-logo-width: clamp(150px, 52vw, 230px);
  }

  .result-title {
    margin-bottom: 12px;
    font-size: 21px;
  }

  .result-line,
  .branch-line {
    margin-bottom: 12px;
    font-size: 16px;
  }

  .player-details,
  .promo-label {
    margin-bottom: 12px;
    font-size: 15px;
  }

  .promo-code,
  .hard-luck-message {
    margin-bottom: 14px;
    font-size: 16px;
  }

  .expiry {
    margin-bottom: 14px;
    font-size: 14px;
  }
}

@media (orientation: portrait) {
  .screen.wheel-screen {
    --wheel-bg-image: url("assets/wheel-bg-mobile.webp");
  }
}

@media (max-height: 680px) and (max-width: 720px) {
  .card {
    /* margin-top: 147px; */
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .brand-lockup {
    margin-bottom: 10px;
  }

  .form-grid {
    gap: 8px;
  }

  .gift-pile {
    max-height: 13vh;
    margin-top: 8px;
  }

  .screen.wheel-screen {
    --stage-padding-top: clamp(28px, 7svh, 48px);
    --stage-padding-bottom: clamp(6px, 1.5svh, 14px);
    --stage-row-gap: clamp(4px, 1svh, 10px);
    --wheel-size: min(320px, 84vw, calc(100svh - 250px));
    --wheel-gift-width: min(210px, 56vw);
    --wheel-gift-gap: 2px;
    --wheel-heading-size: clamp(23px, 7vw, 29px);
    --bottom-brand-logo-width: clamp(140px, 48vw, 210px);
  }
}
