html,
body {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
}

.wheel-page {
  --mint: #9fffe2;
  --mint-strong: #48e7bd;
  --paper: #f7fffb;
  --ink: #050b0a;
  --panel: rgba(7, 18, 16, 0.58);
  --line: rgba(159, 255, 226, 0.24);
  --soft: rgba(255, 255, 255, 0.68);
  --hit-pad: clamp(26px, 5.4vw, 42px);
  --panel-blur: blur(18px);
  touch-action: none;
  -webkit-text-size-adjust: 100%;
  -webkit-user-select: none;
  user-select: none;
}

.wheel-page * {
  -webkit-tap-highlight-color: transparent;
}

.wheel-app {
  position: relative;
  z-index: 1;
  width: 100vw;
  height: 100vh;
  height: 100svh;
  height: 100dvh;
  display: grid;
  place-items: center;
  padding: 0;
  overflow: hidden;
  text-align: center;
  overscroll-behavior: none;
  touch-action: none;
}

.wheel-header {
  position: fixed;
  top: max(16px, calc(env(safe-area-inset-top) + 10px));
  left: 50%;
  z-index: 3;
  transform: translateX(-50%);
  pointer-events: none;
}

.site-mark {
  display: inline-flex;
  margin: 0;
  color: var(--mint);
  font-size: clamp(16px, 2.2vw, 24px);
  font-weight: 900;
  text-decoration: none;
  text-transform: uppercase;
  pointer-events: auto;
}

.site-mark:hover,
.site-mark:focus-visible {
  color: #fff;
  outline: none;
}

.wheel-result {
  min-height: 28px;
  margin: 8px 0 0;
  color: var(--soft);
  font-size: clamp(17px, 2.2vw, 24px);
  font-weight: 800;
  line-height: 1.16;
}

.wheel-stage {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.wheel-shell {
  position: relative;
  width: min(60vw, 52vh, 470px);
  min-width: 276px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  cursor: grab;
  filter: drop-shadow(0 34px 58px rgba(0, 0, 0, 0.5));
  pointer-events: auto;
  touch-action: none;
  user-select: none;
}

.wheel-shell.is-dragging {
  cursor: grabbing;
}

.wheel-shell::before {
  content: "";
  position: absolute;
  inset: calc(var(--hit-pad) - 14px);
  border: 1px solid rgba(159, 255, 226, 0.3);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, transparent 57%, rgba(159, 255, 226, 0.11) 58%, transparent 68%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.02));
  box-shadow:
    0 0 0 8px rgba(159, 255, 226, 0.035),
    inset 0 0 34px rgba(159, 255, 226, 0.1);
}

.wheel-shell::after {
  content: "";
  position: absolute;
  inset: calc(var(--hit-pad) + 4px);
  z-index: 2;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 50%;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.2), transparent 34%, rgba(159, 255, 226, 0.12) 72%, transparent);
  mix-blend-mode: screen;
  pointer-events: none;
}

.wheel {
  position: relative;
  z-index: 1;
  width: calc(100% - var(--hit-pad) * 2);
  height: calc(100% - var(--hit-pad) * 2);
  border-radius: 50%;
  transform: rotate(0deg);
  will-change: transform;
  touch-action: none;
}

.wheel text {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-anchor: middle;
  text-transform: uppercase;
  user-select: none;
  pointer-events: none;
}

.wheel path {
  stroke: rgba(159, 255, 226, 0.2);
  stroke-width: 1.6;
}

.wheel .wheel-rim {
  fill: none;
  stroke: rgba(159, 255, 226, 0.46);
  stroke-width: 6;
}

.wheel .wheel-rim-shadow {
  fill: none;
  stroke: rgba(3, 12, 10, 0.75);
  stroke-width: 16;
}

.wheel .wheel-tick {
  stroke: rgba(255, 255, 255, 0.34);
  stroke-linecap: round;
  stroke-width: 2;
}

.wheel .wheel-tick.is-major {
  stroke: rgba(159, 255, 226, 0.68);
  stroke-width: 3;
}

.wheel-center {
  position: absolute;
  z-index: 3;
  width: 23%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 26%, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.18) 32%, rgba(7, 16, 14, 0.96) 70%),
    #0b1412;
  box-shadow:
    0 14px 30px rgba(0, 0, 0, 0.42),
    inset 0 0 22px rgba(159, 255, 226, 0.2);
  pointer-events: none;
}

.wheel-center img {
  width: 70%;
  height: 70%;
  object-fit: contain;
  filter:
    drop-shadow(0 0 10px rgba(159, 255, 226, 0.38))
    drop-shadow(0 8px 12px rgba(0, 0, 0, 0.42));
  pointer-events: none;
}

.wheel-pointer {
  position: absolute;
  z-index: 4;
  top: calc(var(--hit-pad) - 28px);
  left: 50%;
  width: 36px;
  height: 52px;
  transform: translateX(-50%);
  clip-path: polygon(50% 100%, 0 0, 100% 0);
  background:
    linear-gradient(180deg, #fff 0%, var(--mint) 52%, var(--mint-strong) 100%);
  filter: drop-shadow(0 12px 16px rgba(0, 0, 0, 0.46));
  pointer-events: none;
}

.spin-button {
  position: absolute;
  top: calc(50% + min(30vw, 26vh, 235px) + 18px);
  left: 50%;
  transform: translateX(-50%);
  width: min(230px, 74vw);
  min-height: 52px;
  border: 1px solid rgba(159, 255, 226, 0.5);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(159, 255, 226, 0.96), rgba(255, 255, 255, 0.92));
  color: #04100d;
  cursor: pointer;
  font: inherit;
  font-size: 16px;
  font-weight: 900;
  pointer-events: auto;
  touch-action: manipulation;
  box-shadow:
    0 20px 34px rgba(72, 231, 189, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.58);
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    opacity 160ms ease;
}

.spin-button:hover {
  transform: translate(-50%, -2px);
  box-shadow:
    0 25px 40px rgba(72, 231, 189, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.64);
}

.spin-button:active {
  transform: translateX(-50%);
}

.spin-button:disabled {
  cursor: wait;
  opacity: 0.64;
  transform: translateX(-50%);
}

.settings {
  position: fixed;
  right: max(clamp(14px, 3vw, 28px), calc(env(safe-area-inset-right) + 14px));
  bottom: max(clamp(14px, 3vw, 28px), calc(env(safe-area-inset-bottom) + 14px));
  z-index: 8;
  width: 58px;
  height: 58px;
}

.settings-toggle {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(159, 255, 226, 0.38);
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 24%, rgba(255, 255, 255, 0.3), transparent 38%),
    rgba(7, 18, 16, 0.84);
  color: var(--mint);
  cursor: pointer;
  touch-action: manipulation;
  box-shadow:
    0 18px 36px rgba(0, 0, 0, 0.42),
    inset 0 0 24px rgba(159, 255, 226, 0.08);
  backdrop-filter: var(--panel-blur);
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.settings-toggle:hover,
.settings.is-open .settings-toggle {
  transform: translateY(-2px);
  border-color: rgba(159, 255, 226, 0.72);
  background:
    radial-gradient(circle at 34% 24%, rgba(255, 255, 255, 0.36), transparent 38%),
    rgba(10, 30, 26, 0.9);
}

.settings-toggle svg {
  width: 25px;
  height: 25px;
  fill: currentColor;
}

.settings-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 12px);
  width: min(340px, calc(100vw - 28px));
  max-height: min(520px, calc(100dvh - 104px));
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid rgba(159, 255, 226, 0.24);
  border-radius: 12px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.08), transparent 34%),
    rgba(5, 13, 12, 0.9);
  box-shadow:
    0 28px 60px rgba(0, 0, 0, 0.52),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: var(--panel-blur);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px) scale(0.98);
  transform-origin: bottom right;
  transition:
    opacity 170ms ease,
    transform 170ms ease;
  touch-action: none;
}

.settings.is-open .settings-panel {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.settings-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
}

.settings-head p,
.settings-head span {
  margin: 0;
}

.settings-head p {
  color: #fff;
  font-size: 17px;
  font-weight: 900;
}

.settings-head span {
  color: var(--mint);
  font-size: 13px;
  font-weight: 800;
}

.settings-count {
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  align-items: center;
  min-height: 46px;
  border: 1px solid rgba(159, 255, 226, 0.18);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
}

.settings-count button,
.remove-item,
.add-item {
  border: 0;
  color: #06110f;
  cursor: pointer;
  font: inherit;
  font-weight: 900;
}

.settings-count button {
  height: 100%;
  background: rgba(159, 255, 226, 0.94);
  font-size: 22px;
}

.settings-count button:disabled,
.add-item:disabled {
  cursor: not-allowed;
  opacity: 0.44;
}

.settings-count span {
  color: #fff;
  font-size: 15px;
  font-weight: 900;
  text-align: center;
}

.settings-list {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
  padding-right: 3px;
  touch-action: pan-y;
  overscroll-behavior: contain;
}

.settings-item {
  display: grid;
  grid-template-columns: 1fr 40px;
  gap: 8px;
}

.settings-item input {
  min-width: 0;
  min-height: 42px;
  border: 1px solid rgba(159, 255, 226, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font: inherit;
  font-size: 16px;
  font-weight: 800;
  outline: none;
  padding: 0 12px;
  -webkit-user-select: text;
  user-select: text;
  touch-action: manipulation;
}

.settings-item input:focus {
  border-color: rgba(159, 255, 226, 0.72);
  box-shadow: 0 0 0 3px rgba(159, 255, 226, 0.1);
}

.remove-item {
  min-height: 42px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  font-size: 20px;
}

.remove-item:disabled {
  cursor: not-allowed;
  opacity: 0.36;
}

.add-item {
  min-height: 44px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(159, 255, 226, 0.98), rgba(255, 255, 255, 0.9));
  font-size: 15px;
}

@media (max-width: 760px) {
  .wheel-header {
    width: min(92vw, 420px);
  }

  .site-mark {
    font-size: 17px;
  }

  .wheel-result {
    margin-top: 8px;
    font-size: clamp(16px, 4.8vw, 22px);
  }

  .wheel-shell {
    width: min(86vw, 52vh, 430px);
    min-width: 240px;
  }

  .spin-button {
    top: auto;
    bottom: max(24px, calc(env(safe-area-inset-bottom) + 18px));
  }

  .wheel-pointer {
    top: calc(var(--hit-pad) - 23px);
    width: 30px;
    height: 43px;
  }

  .spin-button {
    min-height: 52px;
    font-size: 16px;
  }

  .settings-toggle {
    width: 54px;
    height: 54px;
  }

  .settings {
    right: max(12px, calc(env(safe-area-inset-right) + 12px));
    bottom: max(12px, calc(env(safe-area-inset-bottom) + 12px));
  }

  .settings-panel {
    max-height: min(500px, calc(100dvh - 92px));
  }
}

@media (max-height: 680px) {
  .site-mark,
  .wheel-result {
    margin-top: 6px;
  }

  .wheel-shell {
    width: min(76vw, 47vh, 320px);
  }

  .spin-button {
    top: calc(50% + min(38vw, 23.5vh, 160px) + 12px);
    bottom: auto;
  }

  .spin-button {
    min-height: 46px;
  }
}
