:root {
  --ink: #203047;
  --paper: #fffdf6;
  --sky: #87d8ff;
  --mint: #65d69e;
  --sun: #ffd45c;
  --coral: #ff705d;
  --berry: #b85cff;
  --blue: #3867ff;
  --shadow: 0 20px 60px rgba(32, 48, 71, 0.18);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  font-family: "Trebuchet MS", Verdana, sans-serif;
  background:
    radial-gradient(circle at 12% 18%, rgba(255, 212, 92, 0.42), transparent 24%),
    radial-gradient(circle at 90% 12%, rgba(101, 214, 158, 0.38), transparent 28%),
    linear-gradient(135deg, #fff7ca 0%, #eaf8ff 46%, #fff0f2 100%);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  background-image:
    linear-gradient(90deg, rgba(32, 48, 71, 0.06) 1px, transparent 1px),
    linear-gradient(rgba(32, 48, 71, 0.06) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.75), transparent);
}

.app {
  display: grid;
  grid-template-columns: minmax(320px, 1.1fr) minmax(300px, 0.9fr);
  gap: clamp(22px, 4vw, 54px);
  width: min(1180px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: clamp(22px, 4vw, 54px) 0;
  align-items: center;
}

.wheel-panel,
.selection-card {
  min-width: 0;
}

.intro {
  max-width: 680px;
  margin-bottom: 22px;
}

.kicker,
.result-label {
  margin: 0 0 8px;
  font-size: 0.9rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
  color: #6a358f;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 5.2rem;
  line-height: 0.92;
}

.lead {
  max-width: 48ch;
  margin: 18px 0 0;
  font-size: 1.2rem;
  line-height: 1.45;
}

.wheel-stage {
  position: relative;
  display: grid;
  place-items: center;
  width: min(100%, 660px);
  aspect-ratio: 1;
}

canvas {
  width: 100%;
  height: 100%;
  border: 12px solid var(--paper);
  border-radius: 50%;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.pointer {
  position: absolute;
  top: -4px;
  z-index: 4;
  width: 0;
  height: 0;
  border-right: 24px solid transparent;
  border-left: 24px solid transparent;
  border-top: 52px solid var(--ink);
  filter: drop-shadow(0 8px 0 rgba(32, 48, 71, 0.14));
}

.spin-button {
  position: absolute;
  z-index: 5;
  display: grid;
  place-items: center;
  width: clamp(116px, 22vw, 168px);
  aspect-ratio: 1;
  border: 8px solid var(--paper);
  border-radius: 50%;
  color: #ffffff;
  background: linear-gradient(145deg, var(--coral), #f23d86);
  box-shadow: 0 14px 0 #b92a62, 0 24px 40px rgba(32, 48, 71, 0.26);
  cursor: pointer;
  font: 900 1.32rem / 1.05 "Trebuchet MS", Verdana, sans-serif;
  letter-spacing: 0;
  text-align: center;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.spin-button:hover {
  transform: translateY(-3px) scale(1.03);
}

.spin-button:active {
  transform: translateY(6px) scale(0.98);
  box-shadow: 0 8px 0 #b92a62, 0 16px 28px rgba(32, 48, 71, 0.22);
}

.spin-button:disabled {
  cursor: wait;
  filter: saturate(0.7);
}

.selection-card {
  padding: clamp(18px, 3vw, 30px);
  border: 8px solid var(--paper);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.selection-card h2,
.modal-sheet h2 {
  font-size: 3.3rem;
  line-height: 1;
}

.selection-card p:last-child {
  max-width: 34ch;
  margin: 16px 0 0;
  font-size: 1.08rem;
  font-weight: 800;
  line-height: 1.45;
}

.game-status {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 18px;
}

.game-status p {
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(135, 216, 255, 0.3);
  font-weight: 900;
}

.reset-button {
  min-height: 42px;
  padding: 10px 14px;
  border: 0;
  border-radius: 8px;
  color: #ffffff;
  background: var(--ink);
  cursor: pointer;
  font: 900 0.98rem / 1 "Trebuchet MS", Verdana, sans-serif;
}

.reset-button:hover {
  transform: translateY(-1px);
}

.exercise-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 18px;
}

.exercise-modal.is-open {
  display: flex;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(32, 48, 71, 0.36);
  backdrop-filter: blur(5px);
}

.modal-sheet {
  position: relative;
  display: grid;
  grid-template-columns: minmax(260px, 0.78fr) minmax(360px, 1.22fr);
  gap: clamp(18px, 3vw, 34px);
  width: min(1120px, 100%);
  max-height: min(760px, calc(100vh - 36px));
  margin-top: 0;
  padding: clamp(18px, 3vw, 30px);
  overflow: auto;
  border: 8px solid var(--paper);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  animation: sheet-in 220ms ease-out;
}

@keyframes sheet-in {
  from {
    transform: translateY(-18px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.close-button {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  color: #ffffff;
  background: var(--ink);
  cursor: pointer;
  font: 900 2rem / 1 Arial, sans-serif;
}

.modal-copy {
  min-width: 0;
  padding-right: 12px;
}

.exercise-art {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1.42;
  min-height: 360px;
  margin: 0;
  overflow: hidden;
  border: 4px solid rgba(32, 48, 71, 0.12);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 212, 92, 0.18), rgba(135, 216, 255, 0.22)),
    #ffffff;
}

.exercise-art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.cheer {
  margin: 18px 0 0;
  padding: 14px 16px;
  border-radius: 8px;
  font-size: 1.08rem;
  font-weight: 800;
  line-height: 1.35;
  background: #fff1a6;
}

.exercise-steps {
  display: grid;
  gap: 10px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.exercise-steps li {
  position: relative;
  min-height: 46px;
  padding: 12px 12px 12px 54px;
  border: 2px solid rgba(32, 48, 71, 0.1);
  border-radius: 8px;
  background: #ffffff;
  font-weight: 800;
  line-height: 1.35;
  counter-increment: step;
}

.exercise-steps li::before {
  position: absolute;
  left: 12px;
  top: 10px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: #ffffff;
  background: var(--blue);
  content: counter(step);
  font-weight: 900;
}

body.modal-open {
  overflow: hidden;
}

.confetti-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.confetti {
  position: absolute;
  top: -20px;
  width: 12px;
  height: 18px;
  border-radius: 3px;
  animation: fall 900ms ease-in forwards;
}

@keyframes fall {
  to {
    transform: translateY(110vh) rotate(460deg);
    opacity: 0.2;
  }
}

@media (max-width: 860px) {
  h1 {
    font-size: 4.1rem;
  }

  .selection-card h2,
  .modal-sheet h2 {
    font-size: 2.8rem;
  }

  .app {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .wheel-stage {
    margin: 0 auto;
  }

  .selection-card {
    padding: 18px;
  }

  .modal-sheet {
    grid-template-columns: 1fr;
    max-height: calc(100vh - 24px);
    padding-top: 58px;
  }

  .exercise-art {
    min-height: 300px;
    order: -1;
  }
}

@media (max-width: 520px) {
  .app {
    width: min(100% - 20px, 1180px);
    padding-top: 22px;
  }

  h1 {
    font-size: 2.45rem;
    line-height: 1;
  }

  .lead {
    max-width: 30ch;
    font-size: 1rem;
  }

  .spin-button {
    font-size: 1rem;
  }

  .selection-card h2,
  .modal-sheet h2 {
    font-size: 2rem;
  }

  canvas {
    border-width: 8px;
  }

  .pointer {
    border-right-width: 18px;
    border-left-width: 18px;
    border-top-width: 40px;
  }

  .exercise-art {
    min-height: 230px;
  }

  .exercise-modal {
    padding: 10px;
  }

  .modal-sheet {
    gap: 14px;
    max-height: calc(100vh - 20px);
    padding: 54px 14px 14px;
  }

  .modal-copy {
    padding-right: 0;
  }

  .exercise-steps li {
    padding-right: 10px;
    font-size: 0.98rem;
  }
}
