[data-direction-wheel] > :is(.mol-select, select[data-global-support]),
.direction-wheel-trigger[hidden] {
  display: none !important;
}

html.direction-wheel-open {
  overflow: hidden;
  overscroll-behavior: none;
}

dialog.direction-wheel {
  --direction-wheel-row: 54px;
  --direction-wheel-rail: clamp(54px, calc(var(--direction-wheel-visible, 100dvh) - 122px), 270px);
  position: fixed;
  inset: auto 0 calc(var(--direction-wheel-bottom, 0px) + max(12px, env(safe-area-inset-bottom)));
  box-sizing: border-box;
  width: min(460px, calc(100% - 28px));
  max-width: none;
  max-height: calc(var(--direction-wheel-visible, 100dvh) - max(12px, env(safe-area-inset-bottom)) - 12px);
  margin: 0 auto;
  padding: 10px 16px 18px;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid rgb(255 255 255 / 88%);
  border-radius: 34px;
  background: radial-gradient(ellipse at 35% 0%, #fff 0%, #fdfdf8 48%, #eef2e8 100%);
  color: #183f32;
  font: 400 16px/1.3 system-ui, sans-serif;
  box-shadow: 0 28px 70px -20px rgb(15 38 28 / 48%), 0 8px 18px -10px rgb(15 38 28 / 32%), inset 0 2px 2px #fff, inset 0 -2px 3px rgb(94 121 81 / 12%);
}

dialog.direction-wheel[open] {
  display: block;
  animation: direction-wheel-in 200ms ease-out both;
}

dialog.direction-wheel::backdrop {
  background: rgb(21 39 30 / 34%);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: direction-wheel-backdrop 170ms ease-out both;
}

.direction-wheel__bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 4px;
  min-height: 48px;
  padding: 0 0 8px;
}

.direction-wheel .direction-wheel__bar h2 {
  margin: 0;
  color: inherit;
  font: 650 16px/1.2 system-ui, sans-serif;
  text-align: center;
}

.direction-wheel__bar button {
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: #2d614a;
  font: 500 15px/1.2 system-ui, sans-serif;
  cursor: pointer;
}

.direction-wheel__bar .direction-wheel__cancel {
  justify-self: start;
}

.direction-wheel__bar .direction-wheel__done {
  justify-self: end;
  border-color: rgb(255 255 255 / 40%);
  background: linear-gradient(180deg, #3d785e, #285b44);
  color: #fff;
  font-weight: 650;
  box-shadow: 0 3px 7px rgb(24 67 46 / 15%), inset 0 1px 1px rgb(255 255 255 / 22%);
}

.direction-wheel__drum {
  position: relative;
  height: var(--direction-wheel-rail);
  margin-top: 4px;
  overflow: hidden;
  isolation: isolate;
  border-radius: 50% / 13%;
  background: linear-gradient(90deg, #e0e6d9 0%, #f1f4eb 12%, #fdfef9 40%, #f8fbf3 62%, #edf2e6 88%, #dce4d4 100%);
  box-shadow: inset 0 1px 2px rgb(91 112 77 / 16%), inset 0 -2px 4px rgb(91 112 77 / 12%), 0 2px 2px rgb(255 255 255 / 90%);
}

.direction-wheel__drum::before {
  position: absolute;
  z-index: 0;
  top: 50%;
  right: 4px;
  left: 4px;
  height: var(--direction-wheel-row);
  box-sizing: border-box;
  border: 1px solid rgb(154 178 135 / 38%);
  border-radius: 50% / 18%;
  background: linear-gradient(180deg, rgb(255 255 255 / 86%), rgb(218 232 205 / 86%) 48%, rgb(231 241 221 / 90%) 77%, rgb(193 214 176 / 68%));
  box-shadow: inset 0 2px 2px #fff, inset 0 -1px 2px rgb(100 132 77 / 15%), 0 3px 8px rgb(45 80 29 / 12%);
  transform: translateY(-50%);
  content: "";
}

.direction-wheel__drum::after {
  position: absolute;
  z-index: 2;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgb(232 237 224 / 98%) 0%, rgb(246 249 239 / 68%) 12%, transparent 34%, transparent 66%, rgb(237 243 226 / 64%) 88%, rgb(215 225 204 / 94%) 100%);
  box-shadow: inset 9px 0 13px -10px rgb(61 90 44 / 28%), inset -9px 0 13px -10px rgb(61 90 44 / 28%);
  pointer-events: none;
  content: "";
}

.direction-wheel__rail {
  position: relative;
  z-index: 1;
  height: 100%;
  overflow: auto;
  overscroll-behavior: contain;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  touch-action: pan-y;
}

.direction-wheel__rail::-webkit-scrollbar {
  display: none;
}

.direction-wheel__track {
  padding-block: calc((var(--direction-wheel-rail) - var(--direction-wheel-row)) / 2);
}

.direction-wheel__row {
  display: grid;
  box-sizing: border-box;
  place-items: center;
  min-width: 0;
  height: var(--direction-wheel-row);
  padding: 4px 12px;
  scroll-snap-align: center;
  text-align: center;
  cursor: pointer;
}

.direction-wheel__row span {
  display: block;
  max-width: 100%;
  backface-visibility: hidden;
  overflow-wrap: anywhere;
  pointer-events: none;
}

.direction-wheel__row[aria-selected="true"] span {
  color: #1c4533;
  font-weight: 650;
  text-shadow: 0 1px 0 rgb(255 255 255 / 80%);
}

.direction-wheel button:focus-visible {
  outline: 2px solid #507c62;
  outline-offset: 2px;
}

.direction-wheel__rail:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px rgb(74 111 55 / 32%);
  border-radius: 50% / 13%;
}

@media (hover: hover) {
  .direction-wheel__cancel:hover { background: rgb(75 110 57 / 7%); }
  .direction-wheel__done:hover { filter: brightness(1.07); }
}

@keyframes direction-wheel-in {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
}

@keyframes direction-wheel-backdrop {
  from { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  dialog.direction-wheel[open],
  dialog.direction-wheel::backdrop { animation: none; }
  .direction-wheel__row span { transform: none !important; opacity: 1 !important; }
}

@media (min-width: 700px) and (hover: hover) and (pointer: fine) {
  dialog.direction-wheel {
    inset: 0;
    height: fit-content;
    margin: auto;
    padding: 12px 20px 20px;
    border-radius: 38px;
  }
}

@media (forced-colors: active) {
  dialog.direction-wheel { border: 1px solid CanvasText; background: Canvas; color: CanvasText; }
  .direction-wheel__bar .direction-wheel__done { border-color: ButtonText; background: ButtonFace; color: ButtonText; }
  .direction-wheel__drum { border: 1px solid CanvasText; background: Canvas; }
  .direction-wheel__drum::before { border-color: Highlight; background: Canvas; }
  .direction-wheel__drum::after { display: none; }
  .direction-wheel__row[aria-selected="true"] span { color: Highlight; }
  .direction-wheel__rail:focus-visible { outline: 2px solid Highlight; outline-offset: -2px; }
}
