:root {
  --picker-background: #ffffff;
  --picker-text: #111111;
  --picker-highlight: rgba(0, 0, 0, 0.05);
  --item-height: 44px;
  --visible-rows: 5;
  --perspective: 1000px;
  --wheel-width: 320px;
}

/* Input Field Styles */
.input-wrapper {
  text-align: center;
}

/* Modal Overlay */
.picker-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 1001;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(2px);
}

.picker-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

/* Modal Container */
.picker-modal {
  background: var(--picker-background);
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  padding-bottom: max(20px, env(safe-area-inset-bottom));
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 100%;
}

/* On larger screens, center the modal like a popup */
@media (min-width: 500px) {
  .picker-modal {
    width: 400px;
    align-self: center;
    margin: auto;
    border-radius: 16px;
    transform: translateY(20px) scale(0.95);
    opacity: 0;
  }
  .picker-overlay.visible .picker-modal {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}
@media (max-width: 499px) {
  .picker-overlay.visible .picker-modal {
    transform: translateY(0);
  }
}

/* Toolbar Header */
.picker-header {
  display: flex;
  align-items: center;
  border-bottom: 2px solid var(--picker-highlight);
  background: var(--picker-background);
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
}

.picker-header button {
  flex: 1;
  background: none;
  border: none;
  font-size: 17px;
  cursor: pointer;
  padding: 20px;
  transition: opacity 0.2s, background-color 0.2s;
}

.picker-header button:hover {
  background-color: var(--picker-highlight);
}

.picker-header button:active {
  opacity: 0.5;
}

#btn-clear {
  color: #ff3b30;
  border-right: 1px solid var(--picker-highlight);
}
#btn-set {
  color: #007aff;
  border-left: 1px solid var(--picker-highlight);
}

/* Picker Container Adjustment */
.picker-container {
  width: 100%;
  position: relative;
  padding: 10px 0;
  user-select: none;
  touch-action: none;
}

.picker-wheels {
  display: flex;
  justify-content: center;
  height: calc(var(--item-height) * var(--visible-rows));
  position: relative;
  overflow: hidden;
  mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    black 20%,
    black 80%,
    transparent 100%
  );
  -webkit-mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    black 20%,
    black 80%,
    transparent 100%
  );
}

.picker-selection-overlay {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: var(--item-height);
  background: var(--picker-highlight);
  transform: translateY(-50%);
  border-top: 1px solid rgba(128, 128, 128, 0.2);
  border-bottom: 1px solid rgba(128, 128, 128, 0.2);
  pointer-events: none;
  z-index: 0;
}

.wheel {
  flex: 1;
  height: 100%;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  position: relative;
  z-index: 1;
  perspective: var(--perspective);
  transform-style: preserve-3d;
  padding: 0;
  margin: 0;
  text-align: center;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
  cursor: grab;
}

.wheel:active {
  cursor: grabbing;
}

.wheel::-webkit-scrollbar {
  display: none;
}

.wheel-padding {
  height: calc(var(--item-height) * (var(--visible-rows) - 1) / 2);
}

.wheel-item {
  height: var(--item-height);
  line-height: var(--item-height);
  font-size: 20px;
  color: var(--picker-text);
  scroll-snap-align: center;
  scroll-snap-stop: always;
  cursor: pointer;
  backface-visibility: hidden;
  font-weight: 400;
  will-change: transform, opacity;
}

.wheel.month {
  flex: 1.5;
}
.wheel.day {
  flex: 0.8;
}
.wheel.year {
  flex: 1;
}
