.mobile-filter-trigger,
.mobile-filter-sheet {
  display: none;
}

@media (max-width: 767px) {
  body.mobile-filter-sheet-open {
    overflow: hidden;
  }

  .mobile-filter-trigger {
    position: fixed;
    z-index: 880;
    right: 50%;
    bottom: max(16px, env(safe-area-inset-bottom));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 50px;
    padding: 0 22px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    color: #ffffff;
    background: #202020;
    box-shadow: 0 16px 38px rgba(0, 0, 0, 0.26);
    font-family: inherit;
    font-size: 0.84rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.02em;
    transform: translateX(50%);
    cursor: pointer;
  }

  .mobile-filter-trigger::before {
    width: 14px;
    height: 12px;
    background:
      linear-gradient(currentColor, currentColor) top / 100% 2px no-repeat,
      linear-gradient(currentColor, currentColor) center / 100% 2px no-repeat,
      linear-gradient(currentColor, currentColor) bottom / 100% 2px no-repeat;
    content: "";
  }

  .mobile-filter-trigger:focus-visible {
    outline: 3px solid rgba(32, 32, 32, 0.28);
    outline-offset: 3px;
  }

  .mobile-filter-sheet {
    position: fixed;
    z-index: 1600;
    inset: 0;
    display: block;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition:
      visibility 0s linear 300ms,
      opacity 220ms ease;
  }

  .mobile-filter-sheet[hidden] {
    display: none;
  }

  .mobile-filter-sheet.is-open {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    transition-delay: 0s;
  }

  .mobile-filter-sheet__backdrop {
    position: absolute;
    inset: 0;
    width: 100%;
    padding: 0;
    border: 0;
    background: rgba(10, 12, 14, 0.54);
    backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity 240ms ease;
  }

  .mobile-filter-sheet.is-open .mobile-filter-sheet__backdrop {
    opacity: 1;
  }

  .mobile-filter-sheet__panel {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    max-height: min(78dvh, 680px);
    padding-bottom: env(safe-area-inset-bottom);
    border-radius: 24px 24px 0 0;
    background: #ffffff;
    box-shadow: 0 -20px 54px rgba(0, 0, 0, 0.24);
    transform: translateY(102%);
    transition: transform 300ms cubic-bezier(0.22, 1, 0.36, 1);
    will-change: transform;
  }

  .mobile-filter-sheet.is-open .mobile-filter-sheet__panel {
    transform: translateY(0);
  }

  .mobile-filter-sheet__panel.is-dragging {
    transition: none;
  }

  .mobile-filter-sheet__drag {
    position: relative;
    display: block;
    min-height: 30px;
    border: 0;
    background: transparent;
    touch-action: none;
    cursor: grab;
  }

  .mobile-filter-sheet__drag::before {
    position: absolute;
    top: 11px;
    left: 50%;
    width: 46px;
    height: 5px;
    border-radius: 999px;
    background: #cbd0d5;
    content: "";
    transform: translateX(-50%);
  }

  .mobile-filter-sheet__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 4px 20px 16px;
    border-bottom: 1px solid #e6e8eb;
  }

  .mobile-filter-sheet__heading {
    display: grid;
    gap: 4px;
  }

  .mobile-filter-sheet__heading h2,
  .mobile-filter-sheet__heading p {
    margin: 0;
  }

  .mobile-filter-sheet__heading h2 {
    color: #171b20;
    font-size: 1.24rem;
    line-height: 1.2;
  }

  .mobile-filter-sheet__heading p {
    color: #727b85;
    font-size: 0.78rem;
    line-height: 1.45;
  }

  .mobile-filter-sheet__close {
    position: relative;
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid #e0e3e6;
    border-radius: 50%;
    background: #f6f7f8;
    cursor: pointer;
  }

  .mobile-filter-sheet__close::before,
  .mobile-filter-sheet__close::after {
    position: absolute;
    top: 19px;
    left: 11px;
    width: 17px;
    border-top: 2px solid #20252b;
    content: "";
  }

  .mobile-filter-sheet__close::before {
    transform: rotate(45deg);
  }

  .mobile-filter-sheet__close::after {
    transform: rotate(-45deg);
  }

  .mobile-filter-sheet__body {
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 18px 20px 24px;
  }

  .mobile-filter-sheet__list {
    display: grid;
    gap: 9px;
  }

  .mobile-filter-sheet__back-link,
  .mobile-filter-sheet__option {
    text-decoration: none;
  }

  .mobile-filter-sheet__back-link {
    display: inline-flex;
    margin-bottom: 10px;
    color: #646d77;
    font-size: 0.8rem;
    font-weight: 700;
  }

  .mobile-filter-sheet__option {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    min-height: 52px;
    padding: 11px 15px;
    border: 1px solid #e0e3e7;
    border-radius: 12px;
    color: #30363d;
    background: #f8f9fa;
    font-size: 0.88rem;
    font-weight: 700;
  }

  .mobile-filter-sheet__option::after {
    width: 8px;
    height: 8px;
    border-top: 2px solid currentColor;
    border-right: 2px solid currentColor;
    content: "";
    transform: rotate(45deg);
  }

  .mobile-filter-sheet__option.is-current {
    border-color: #202020;
    color: #ffffff;
    background: #202020;
  }

  .mobile-filter-sheet__option-count {
    display: inline-grid;
    min-width: 30px;
    height: 30px;
    padding-inline: 7px;
    border-radius: 999px;
    place-items: center;
    color: #4f5862;
    background: #e7eaed;
    font-size: 0.72rem;
  }

  .mobile-filter-sheet__option.is-current .mobile-filter-sheet__option-count {
    color: #202020;
    background: #ffffff;
  }

  .mobile-filter-sheet__option--counted {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .mobile-filter-sheet__option--counted::after {
    display: none;
  }
}
