body {
  --modal-background: var(--background-secondary);
  --modal-border-color: var(--background-modifier-border-hover);
}

.modal-container {
  perspective: 240px;
}

.modal-bg {
  opacity: 0 !important;
}

@keyframes modalIn {
  from {
    opacity: 0;
    filter: blur(4px);
    transform: scale(0.95) rotateX(-1deg);
  }
}

.modal {
  animation: modalIn var(--anim-duration-moderate) var(--anim-motion-baseline) forwards;
}

// Modal
body:not(.is-mobile) {
  .modal-title {
    margin-left: 0;
  }
}

.modal {
  &:not(.mod-sidebar-layout) {
    border-radius: var(--modal-radius);

    .modal-title {
      font-size: var(--h1-size);
      max-width: 100%;
    }
  }

  .modal-title {
    font-family: var(--h1-font);
    transition: var(--anim-duration-moderate);
    max-width: 0;
    min-width: fit-content;
    overflow: visible;
    text-align: left;
  }

  .modal-content .setting-item {
    padding: 8px 0;
  }
}
.modal-close-button {
  border-radius: 100vh;
  position: absolute;
  top: 8px;
  inset-inline-end: 8px !important;
  height: unset;
  width: unset;
  padding: 8px;
  color: var(--text-faint);
  line-height: 12px;
  z-index: 1;

  &::before {
    content: "\2715";
    line-height: 1;
    display: block;
    text-align: center;
    width: var(--icon-l);
    height: var(--icon-l);
    font-size: var(--icon-m);
  }
}

// Menu & suggestion
@keyframes menuIn {
  from {
    opacity: 0;
    filter: blur(4px);
    transform: translateY(-8px);
  }
}

.menu,
.suggestion-container {
  padding: 0;

  .menu-scroll,
  .suggestion {
    padding: 4px;
  }

  .menu-item,
  .suggestion-item {
    padding: calc(6px * var(--density-modifier)) 8px;
    border-radius: calc(var(--radius-m) - 4px);
    margin-bottom: 0;
  }

  .menu-item-icon {
    order: unset !important;
  }

  .menu-item-icon .svg-icon {
    --icon-size: var(--icon-xs);
  }

  .menu-separator {
    margin: 4px 0;
  }
}

body:not(.is-phone) {
  .menu,
  .suggestion-container {
    animation: menuIn var(--anim-duration-moderate) var(--anim-motion-baseline) forwards;

    .suggestion-item,
    .suggestion-empty {
      font-size: var(--font-ui-small);
    }
  }
}

body.is-phone .menu,
body.is-phone .suggestion-container {
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  overflow: hidden;
  will-change: transform;

  @starting-style {
    opacity: 0;
    filter: none;
    transform: translateY(100%);
  }

  &[style*="transform: translateY"] {
    transition: none;
  }

  .menu-grabber {
    margin: 8px auto;
    position: absolute;
    inset: 0;
  }
  .menu-scroll {
    max-height: 80vh;
    padding: 32px 16px;
  }
  .menu-item {
    padding: calc(16px * var(--density-modifier)) 20px;
    font-size: var(--nav-item-size);
    gap: 16px;
    border-radius: 0;
  }
  .menu-separator {
    margin: calc(12px * var(--density-modifier)) 16px;
  }
  .menu-item-icon .svg-icon {
    --icon-size: var(--icon-s);
  }
}

body.is-tablet .menu,
body.is-tablet .suggestion-container {
  border: 1px solid var(--background-modifier-border-hover);
  overflow: auto;

  .menu-scroll {
    overflow: visible;
  }

  .menu-item {
    padding: 8px 12px;
  }
  .menu-item-icon .svg-icon {
    --icon-size: var(--icon-s);
  }
  .menu-item-title {
    max-width: 240px;
  }
}
